I've written this code as a part of a bigger program :
main()
{ int num;
char word[50];
list_head=NULL;
while(1)
{
puts("Give number : ");
scanf("%d",num);
if (num==0) break;
printf("Give name : ");
gets(word);
if (strcmp(word,"")==0) break;
add_node_to_list(num,word);
}
and i when i run the program,the message "Give number : " appears on the screen and when i give a number then a message appears ("The program does not respond and will close") just like what happens in case of infinite loop.I deduced using debugging that the problem is scanf but i'm not sure.