After wasting too much time searching why my program doesn\'t execute gets() after using scanf(), I found a solution which is to use fflush(stdin) after scanf() to enable ge
If flushing std doesn't work, then try reading in the extra characters and discarding, as suggested here.
This will work:
#include
#include
int main(){
char nombre[10];
char mensaje[80];
int c;
printf("Type your name:\n");
scanf("%9s", nombre);
while((c= getchar()) != '\n' && c != EOF)
/* discard */ ;
printf("Now, type a message:\n");
gets(mensaje);
printf("%s:%s",nombre,mensaje);
return 0;
}