C has a signed char type?

In C, there are unsigned and signed integers:

int test_1 = 42;
test_1 = -42; // It's ok; int is signed

An int is always signed, and so are short, long and long long. So writing signed int and int is the same thing, just two spellings.

The only exception is char. Whether char is signed or unsigned is up to the compiler. For example: signed on x86 and Apple Silicon, unsigned on ARM Linux. In C and C++ char, signed char and unsigned char are three different types, even though char always has the representation of one of the other two.

This is unique to char. For every other integer type, signed X and X are the same type (signed int is int).

Let’s look at a brief example of what this means. We’ll use C’s _Generic.

#include <stdint.h>
#include <stdio.h>
// Only "char" is listed.
#define TYPE_NAME_SHORT(X) _Generic((X), \
char: "char", \
default: "no match")
// All three character types are listed.
#define TYPE_NAME(X) _Generic((X), \
char: "char", \
signed char: "signed char", \
unsigned char: "unsigned char", \
default: "no match")
int main(void) {
char c = 'a';
signed char sc = 'a';
unsigned char uc = 'a';
int8_t i8 = 'a';
printf("char only: %s, %s, %s, %s\n",
TYPE_NAME_SHORT(c), TYPE_NAME_SHORT(sc),
TYPE_NAME_SHORT(uc), TYPE_NAME_SHORT(i8));
printf("all entries: %s, %s, %s, %s\n",
TYPE_NAME(c), TYPE_NAME(sc),
TYPE_NAME(uc), TYPE_NAME(i8));
return 0;
}

Output:

char only: char, no match, no match, no match
all entries: char, signed char, unsigned char, signed char

The int8_t value misses the char entry and is caught by signed char. Adding an int8_t entry next to signed char is rejected:

error: type 'int8_t' (aka 'signed char') in
generic association compatible with previously
specified type 'signed char'

See Attractor PR 13 for context.

Until next time.

@online{zaerl2026-c-has-a-signed-char-type,
  author = {Francesco Bigiarini},
  title = {C has a signed char type?},
  date = {2026-11-16},
  url = {https://zaerl.com/2026/11/16/c-has-a-signed-char-type/},
  urldate = {2026-11-16}
}