how to use atoi() function in c.
Use of atoi () function:-
atoi() is a predefine function which is present in stdlib.h header file in c.It is for cover a string in integer value.
Example:–
#include<stdio.h>
#include<stdlib.h>
int main()
{
char str[19];
int val;
printf(“Enter a stringn“);
scanf(“%s”,str);
val=atoi(str);
printf(“Value of string in integer is %d”,val);
return(0);
}
input:-
Enter a string
7889
output:-
Value of string in integer is 7889
I understand easily sir
Thanks sir