// scanf example // source: http://www.cplusplus.com/ #include #include #define SIZE 80 int main() { char str[SIZE]; int i; printf("Enter your family name: "); scanf("%79s", str); printf("Enter your age: "); scanf("%d", &i); printf("%s, %d years old.\n", str, i); printf("Enter a hexadecimal number: "); scanf("%x", (unsigned int *)&i); printf("You have entered %#x (%d).\n", i, i); return EXIT_SUCCESS; }