#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
int main()
{
int i;
i = atoi(" 100");
printf(" The integer value is: %d ", i);
getch();
return 0;
}
OUTPUT:
The integer value is: 100
NOTE:
If you liked the post/article or if you think this post/article helped you in any way, then please show your appreciation by filling up at least one form from the options given below:
The ? Is convert string to integer but where is the string declaration . . .
ReplyDeletei = atoi(" 100");
Delete100 which is inside quatation
The ? Is convert string to integer but where is the string declaration . . .
ReplyDeleteanything inside double quote is string.
Deleteso "101" is a string
if u want to mention explicitly u can have
char str[]="101";
then
i=atoi(str)
char str[100];
ReplyDeletestr="123"
i=atoi(str);
will do it
actually anything within double quotes is STRING
atoi("101") where 101 is a string
What is atoi()?
ReplyDeleteitz converting from an ascii value to integer value
Deletea denotes alphabet(a) to integer(i)
ReplyDelete