반응형
#include<stdio.h>
int c_atoi(const char *s)
/* author : kyoung chip jang date : descript: */ int main( int argc ,char ** argv ) { char *line = "1234"; int i = c_atoi(line); printf(" atoi = %d \n", i ); return 0; } int c_atoi(const char *s ) { int i, n; n = 0; for (i = 0; s[i] >= '0' && s[i] <= '9'; ++i) n = 10 * n + (s[i] - '0'); return n; }
반응형