Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / C

<stdlib.h> — general utilities

The <stdlib.h> header exposes C library utilities and the RAND_MAX and MB_CUR_MAX macros.

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

Syntax

#include <stdlib.h>

#include <stdlib.h> exposes declarations for numeric conversion, memory management, sorting, and program termination, together with associated types and macros.

RAND_MAX is an integer constant expression: it specifies the largest result of rand() and is at least 32767. Results range from 0 through RAND_MAX, inclusive; the actual maximum depends on the implementation.

MB_CUR_MAX is a positive expression of type size_t, not necessarily a constant. It specifies the maximum bytes per multibyte character for the current locale's LC_CTYPE category. It never exceeds MB_LEN_MAX from <limits.h>. It is not a string's character count.

Examples

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

int main(void)
{
    printf("RAND_MAX >= 32767: %d\n", RAND_MAX >= 32767);
    printf("MB_CUR_MAX > 0: %d\n", MB_CUR_MAX > 0);
    return EXIT_SUCCESS;
}

Result

RAND_MAX >= 32767: 1
MB_CUR_MAX > 0: 1

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