So I have the following code:
void main(int argc, char **argv)
{
int loggedIn=0;
char *currentCommand;
while (!loggedIn)
{
printf("Enter your command:");
scanf("%s",currentCommand);
printf("\n%s\n",currentCommand);
}
}
The problem is scanf() works well the first time, then is starts reading (null) and the output would be Enter your command: (null) in an infinite loop.
I want to input more commands and stop when I change the value of loggedIn, but once I input one command, it starts printing Enter your command: (null) endlesly.
currentCommand