I want to convert a string (ex: 567.2.2.2) into integer or array of integer and i have to check 567 is greater then or less than 256 or not and i have to dispaly. this string is in a file

Showing Answers 1 - 3 of 3 Answers

raja

  • May 7th, 2007
 

    #include<stdlib.h>
int main()
{
char s[]="567.2.2.2";
int a;
a=atoi(s);
if(a>256)
printf("%d is greater",a);
else
printf("%d is smaller",a);
}
atoi function which converts string to integer which returns integer 567 in this program

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions