Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / C

int — signed integer type

int stores signed integers. Its size depends on the implementation; signed arithmetic overflow has undefined behavior.

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

Syntax

int name = value;

int denotes a signed integer type, the same as signed int. unsigned int is a separate unsigned type.

Do not assume 32 bits or four bytes. INT_MIN and INT_MAX from <limits.h> give its limits. C23 requires two's complement representation, but signed arithmetic overflow still has undefined behavior.

Integer division / truncates toward zero; % computes the remainder. Use %d to print an int with printf.

Examples

#include <stdio.h>

int main(void)
{
    int total = 17;
    int count = 5;
    printf("%d %d\n", total / count, total % count);
    return 0;
}

Result

3 2

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