Displaying ./code/jun07/p02scanf.c/* scanf but set up so that it can handle spaces You shouldn't use this method to take in strings, because there is still no protection against buffer overflow. */ #include <stdio.h> int main() { char s[128]; printf("Enter a string: "); scanf( "%[^\n]" ,s); //this conversion is set up so that it will take in all //characters not equal to the newline character. printf("String Entered: %s\n", s); return 0; } |