C program to convert string into integer using atoi() function.

#include<stdio.h>
#include<stdlib.h>

int main()
{
 char str[] = "1245";
 int n;
 
 n = atoi(str);
 
 printf("String value is %s \n",str);
 printf("Number is %d \n",n);

 return 0;
}
OUTPUT:

String value is 1245
Number is 1245

Related Post

Leave a Reply

Your email address will not be published. Required fields are marked *