char *str;
while(1)
{
printf("$$$$>");
scanf("%s",str);
}
In this code I just want to print a command prompt. When user inputs something nothing happens and the command prompt is printed again. But the scanf() runs once and then $$$$> is printed in loop. The code runs when I tried to take a character array instead of str pointer. why?