====== Char to int ====== ===== First possibility ===== char c; //some input to c int number; number = c -'0'; ===== Second possibility ===== char c[2]; c[1]=0; //some input to c number = atoi(c);
char c; //some input to c int number; number = c -'0';
char c[2]; c[1]=0; //some input to c number = atoi(c);