+ 1
Error in scanf() of c program
Could anyone please tell me why pressing 'enter' is making the third scanf() of my code not to work while the previous one is working? Thanks in advance :) https://code.sololearn.com/cxDIxVTfmgr6/?ref=app
2 Respuestas
+ 12
You need to add a space in the third scanf function.
You are taking Numeric inputs before, so sometimes it happens that compiler escapes the next input if it char type.
#include <stdio.h>
int main()
{
int n, m;
char ch;
scanf("%d", &n);
scanf("%d", &m);
scanf(" %c", &ch);
printf("%d, %d_%c", n, m, ch);
return 0;
}
+ 5
I'm not familiar with C but I edited your code. Check the comment.
https://code.sololearn.com/cG2uYTZ5R6sT/?ref=app