Data Types in C: What Is Data Types in C, Sizes & <stdint.h>

When data types are selected in c, each data object will use n bytes of memory, its bits will mean one thing or another, and it will follow a set of arithmetic conversion rules. If you are wondering what is data types in c, the C17 standard divides them into basic arithmetic types (char, int, float, double), qualified signed and unsigned integer widths (short, long, long long), enumerated types (enum), void, and derived types such as pointers, arrays, structures, and unions. Portable firmware and protocol code should use exact-width data types (such as int32_t, uint64_t, and size_t) provided by the stdint.h header, as the standard data types in c only guarantee the minimum bit range, not their size when compiled for 32-bit and 64-bit targets.

Data Types in C: Basic, Derived & Exact-Width <stdint.h> Types — Technical Overview

When data types are selected in c, each data object will use n bytes of memory, its bits will mean one thing or another, and it will follow a set of arithmetic conversion rules. If you are wondering what is data types in c, the C17 standard divides them into basic arithmetic types (char, int, float, double), qualified signed and unsigned integer widths (short, long, long long), enumerated types (enum), void, and derived types such as pointers, arrays, structures, and unions. Portable firmware and protocol code should use exact-width data types (such as int32_t, uint64_t, and size_t) provided by the stdint.h header, as the standard data types in c only guarantee the minimum bit range, not their size when compiled for 32-bit and 64-bit targets.

#include <stdio.h>
#include <stdint.h>

int main(void) {
    printf("char=%zu int=%zu long=%zu double=%zu uint64_t=%zu\n",
           sizeof(char), sizeof(int), sizeof(long), sizeof(double), sizeof(uint64_t));
    return 0;
}

Runnable C example

#include <stdio.h>
#include <stdint.h>

int main(void) {
    printf("char=%zu int=%zu long=%zu double=%zu uint64_t=%zu\n",
           sizeof(char), sizeof(int), sizeof(long), sizeof(double), sizeof(uint64_t));
    return 0;
}

Open example in compiler

Expected Output

char=1 int=4 long=8 double=8 uint64_t=8