Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / C

signed — signed integer types

The signed keyword specifies a signed integer type. On its own, signed means signed int, which is int.

Version: C23; repository compiler flag, production runtime not attested

Syntax

signed name;
signed char name;
signed short int name;
signed int name;
signed long int name;
signed long long int name;
signed _BitInt(N) name;

signed specifies an integer type supporting negative values, zero, and positive values. Used alone, signed means signed int, which is int.

It can accompany char, short, int, long, long long, and _BitInt(N); the signed form requires N to be at least 2. It cannot combine with unsigned or float.

char, signed char, and unsigned char are distinct types. signed alone does not guarantee a 32-bit width. Signed arithmetic overflow has undefined behavior. The example uses small values to avoid it.

Examples

#include <stdio.h>

int main(void)
{
    signed balance = -12;
    signed int change = 5;
    balance += change;
    printf("%d\n", balance);
    return 0;
}

Result

-7

The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.

Sources