On this page
  1. Syntax, Types & Operators
  2. Contents
  3. Minimal Standard C Program
  4. Fundamental Types, sizeof & Bitwise Operators

Syntax, Types & Operators

Prev: fundamentals | Up: fundamentals | Next: Control Flow & Functions
Rel: stdint, stdbool & limits, Binary & Encodings
Ref: cppreference — C Types
Tags: #public #prog #c #fundamentals


Contents


Minimal Standard C Program

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

int main(void) {
    int32_t count = 42;
    printf("count = %d, sizeof(size_t) = %zu\n", count, sizeof(size_t));
    return 0;
}

Compile with strict warnings: cc -std=c17 -Wall -Wextra -Werror main.c -o main.


Fundamental Types, sizeof & Bitwise Operators

uint32_t flags = 0;
const uint32_t READ  = 1u << 0;
const uint32_t WRITE = 1u << 1;
flags |= READ | WRITE;          // set bits
flags &= ~WRITE;                // clear WRITE bit

Linked from

Related notes