I was trying to solve this problem
When i create a char *
and pass it into scanf:
char* input = "";
scanf("%s", input);
It behaves weirdly.
However, when i change the definition and initalize 1000 chars to \0
:
char input[1000] = { '\0' };
It behaves properly. Why is it that way?