Code:
//all headers go here

int main()
{
   char name[20];

   printf("Enter your name : ");
   gets(name); // I replaced using with scanf() too but still have the same problem
   return 0;
}
When I ask for a user input like that , sometimes my console doesn't ask for user input and it just directly went to next instruction. Let's say if I run the above program, when printf prompts " Enter your name " then cursor should be next to the word "name" but instead nothing happens and program suddenly stops. What should I do to prevent from that sort of error ??? I tried replacing with scanf() function instead of gets() , but sometimes I still encounter the same problem. Can anyone suggest me what should I do ??? Thanks all in advance.