Skip to content
Snippets Groups Projects
sizeof.c 876 B
Newer Older
Bruce Cowan's avatar
Bruce Cowan committed
#include <complex.h>
#include <stdio.h>
#include <stdint.h>

int
main (void)
{
    printf ("char is %zu bytes\n", sizeof (char));
    printf ("short is %zu bytes\n", sizeof (short));
    printf ("int is %zu bytes\n", sizeof (int));
    printf ("long is %zu bytes\n", sizeof (long));
    printf ("long long is %zu bytes\n", sizeof (long long));

    printf ("intmax_t is %zu bytes\n", sizeof (intmax_t));
    printf ("intptr_t is %zu bytes\n", sizeof (intptr_t));

    printf ("float is %zu bytes\n", sizeof (float));
    printf ("double is %zu bytes\n", sizeof (double));
    printf ("long double is %zu bytes\n", sizeof (long double));

    printf ("complex float is %zu bytes\n", sizeof (complex float));
    printf ("complex double is %zu bytes\n", sizeof (complex double));
    printf ("complex long double is %zu bytes\n", sizeof (complex long double));

    return 0;
}