Dear all:
Following is the program I wrote:
But the output does not print the string I entered:Code:#include <stdio.h> int main () { char *string; printf("Enter something: "); scanf("%s", string); printf("The string you entered is %s\n", string); return 0; }
Enter something: string
The string you entered is (null)
If I change "char *string" to "char string[10]", it works fine, can anyone help me, thanks in advance