Question: I've just started reading about C and currently playing around with format specifiers.
Here is the code example:

```
#include <stdio.h>

int main(void) {
    char code = 'a' - 'A';
    printf("\n>>>%c (%d)", code, code);
    printf("\n>>>%c", 32);

    char incode;
    printf("\n\nGive me some char: ");
    scanf("%c", &incode);
    printf("\n>>>%c (%d)", incode, incode);
    return 0;
}

```

The output:

```
PS C:\ex> ./print

>>>  (32)
>>>

Give me some char: A

>>>A (65)

```

So, why does `%c` work in the last `printf` and doesn't work in the beginning?
I tested this sample on Windows and on Linux and both behave identically.

* Windows compiler: `gcc.exe (x86_64-posix-seh-rev0, Built by MinGW-W64 project) 8.1.0`
* Linux compiler: `clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)`

Answer: 
ASCII 32 is `' '` (space). It is printed alright, you just can't see it.  

If you change the format string to `"\n>>>%c<< (%d)"` you will see it in the (pun) negative space.  

You can also pass the output through `od -a` to confirm.
Assume that your character encoding is [ASCII](https://en.wikipedia.org/wiki/ASCII). Then `a` is encoded as 97 (decimal) and `A` is encoded as 65 (decimal). Their difference is 32, which encodes the  space character.

So `char code = 'a' - 'A';` is the same as `char code = 32;` which is the same as the declaration `char code = ' ';`

See also [this C reference](https://en.cppreference.com/w/c) website.

If allowed, compile with all warnings and debug info, so (with [GCC](http://gcc.gnu.org/)) as `gcc -Wall -Wextra -g`

You could compile your C source code `minerals.c` with `gcc -Wall -O -fverbose-asm minerals.c -S -o minerals.s` and look inside the generated assembler code `foo.s`. On my Debian computer with GCC 10.2 I am getting the following warning:

```
minerals.c: In function ‘main’:
minerals.c:11:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   11 |     scanf("%c", &incode);
      |     ^~~~~~~~~~~~~~~~~~~~

```

The generated assembler code has:

```
 # /usr/include/x86_64-linux-gnu/bits/stdio2.h:107:   return __printf_chk (__USE_FORTIFY_LEVEL - 1, __fmt, __va_arg_pack ());
         movl    $32, %ecx       #,
         movl    $32, %edx       #,
         leaq    .LC0(%rip), %rsi        #,
         movl    $1, %edi        #,
         call    __printf_chk@PLT        #
         movl    $32, %edx       #,           // 32 is the space
         leaq    .LC1(%rip), %rsi        #,
         movl    $1, %edi        #,
         movl    $0, %eax        #,
         call    __printf_chk@PLT        #
         leaq    .LC2(%rip), %rsi        #,
         movl    $1, %edi        #,
         movl    $0, %eax        #,
         call    __printf_chk@PLT        #

```

Actually, in 2021, [UTF-8 is used everywhere](https://utf8everywhere.org/) (and complicates matter). Look into [GNU libunistring](https://www.gnu.org/software/libunistring/).