// atoi example // source: http://www.cplusplus.com/ #include #include #define SIZE 256 int main() { int i; char buffer[SIZE]; printf ("Enter a number: "); // read a number as a string "1900" fgets(buffer, sizeof(buffer), stdin); // now convert it to a numerical value and store in integer // now the string "1900" is coverted to an numerical value 1900 // stored in i i = atoi(buffer); printf ("The value entered is %d. Its double is %d.\n",i,i*2); return EXIT_SUCCESS; }