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 string\n");
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
2 Comments
I understand easily sir
ReplyDeleteThanks sir
ReplyDelete