Friday, July 31, 2009

What do atoi function in c language do?

converts an ascii string in to a integer number

What do atoi function in c language do?
Hello


atoi stands for array to integer. It converts array(string) to integer valule.


Eg.


{


char val[4];


int res;


printf("Enter a value");


gets(val);


res = atoi(res);


printf(" Its value is %d",res);


getch();


}


Thanks


Jana.KV
Reply:atoi function is used to convert an ASCII string (charator array) to number. You can probably use it when you need to find the ascii value for a single charator or for a string.





Areas of application : can be used in encription or decription





G.Format : integer_variable = atoi(charator_array);


int=atoi(char[]);
Reply:the answer given by somebody above me is quite good........ except he made a slight error in his example -


- change the line


res = atoi(res);


- to


res = atoi(val);
Reply:its a macro that converts string to integer





for more details check ur Turbo C++ help


No comments:

Post a Comment