Question: ```
#include <stdio.h>

int main(){
    char testChar;

    printf("%d\n", scanf("%c", &testChar));

    return 0;
}

```

All I wanted was to print the number of characters scanned. But, when I all of my inputs have the same output , i.e. 1.

Answer: 
[`scanf()`](http://man7.org/linux/man-pages/man3/scanf.3.html) returns the number of items successfully scanned. So, in all your runs `scanf()` succeeded and hence your program prints 1.

From [`scanf()`](http://man7.org/linux/man-pages/man3/scanf.3.html):

> 
> On success, these functions return the number of input items
> successfully matched and assigned; this can be fewer than provided
> for, or even zero, in the event of an early matching failure.
> 
> 
> The value EOF is returned if the end of input is reached before either the
> first successful conversion or a matching failure occurs. EOF is also
> returned if a read error occurs, in which case the error indicator for
> the stream (see ferror(3)) is set, and errno is set to indicate the
> error.
> 
> 
>
You can try this to print the number of characters read from `stdin`. With the use of `scanf` in a loop. 

```
#include <stdio.h>
#include <stdlib.h>

int
main(void) {
    char testChar;
    int numchar = 0;

    printf("Enter characters, CTRL-C to end:\n");
    while (scanf("%c", &testChar) == 1) {
        numchar++;
    }

    printf("Number of characters scanned: %d\n", numchar);

    return 0;
}

```