Sunday, August 2, 2009

Write a c Function which converts string to an integer?

prototype of atoi function

Write a c Function which converts string to an integer?
#include %26lt;ctype.h%26gt;





int atoi(char *s)


{ int r=0;


while (isdigit(*s))


{ r = (10*r) + (int)(*s-'0');


s++;


}


return r;


}

bottle palm

No comments:

Post a Comment