#include<stdio.h>
#include<string.h>
int main()
{
char buffer[32];
char c;
int i;
printf("input: ");
fgets(buffer, 32, stdin);
printf("items filled: %d\n", sscanf("%c%d\n", &c, &i));
printf("%c%d\n", c, i);
return 0;
}
When typing a character followed by a number “f7”, im expecting “f” to go into variable c, and “7” to go into variable i. For some reason, sscanf() fails to fill both, and I’m getting their initial garbage values. What am I doing wrong?
Actual
sscanf()signature is this :check your signature of
sscanf()you have used wrong signatureIt should be