IB001 – Seminární skupiny 16, 17, 18 a 19

Veľkosť datových typov – zdrojový kód

/*
    Program na vypis velkosti celociselnych datovych typov
*/

#include <stdio.h>
#include <limits.h>

int main(void)
{
    printf("Velkost jednotlivych celocicelnych datovych typov:\n\n");
    printf("short              %d B %20hd az %hd\n", sizeof(short), SHRT_MIN, SHRT_MAX);
    printf("int                %d B %20d az %d\n", sizeof(int), INT_MIN, INT_MAX);
    printf("long               %d B %20ld az %ld\n", sizeof(long), LONG_MIN, LONG_MAX);
    printf("long long          %d B %20lld az %lld\n\n", sizeof(long long), LLONG_MIN, LLONG_MAX);
    printf("unsigned short     %d B %20hu az %hu\n", sizeof(unsigned short), 0u, USHRT_MAX);
    printf("unsigned int       %d B %20u az %u\n", sizeof(unsigned int), 0u, UINT_MAX);
    printf("unsigned long      %d B %20lu az %lu\n", sizeof(unsigned long), 0Lu, ULONG_MAX);
    printf("unsigned long long %d B %20llu az %llu\n", sizeof(unsigned long long), 0LLu, ULLONG_MAX);

    return 0;
}