sscanf unexpected results

c, scanf

Solution

Actual `sscanf()` signature is this :

int sscanf(const char *str, const char *format, ...);

check your signature of `sscanf()` you have used wrong signature

It should be

sscanf(buffer,"%c%d\n", &c, &i);

Problem

``` #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?

Original source