c - Convert from char * to int -
i have string char * = '343'. want convert integer value.
example. char *a = "44221" want store value into int a;
this should
#include <stdlib.h> inline int to_int(const char *s) { return atoi(s); }
just in case example usage
int main( int ac, char *av[] ) { printf(" to_int(%s) = %d " ,av[1] , to_int(av[1]) ); return 0; }
Nice Post. keep it up. Other wise If If Any one who want learn C++ & Advance contact us on 9311002620 or visit :- https://htsindia.com/Courses/embedded-systems-and-robotics/cplusplustraininginstituteinsouthdelhi
ReplyDelete