C Programming·The fundamentals of memory

Compilation and types

C is compiled ahead of time and has a small set of primitive types.

Beginner 12 min read Lesson 6 of 300 Challenge included
What you will be able to do
  • Use inttypes.h types such as int32_t when size matters.
  • Compile with -Wall -Wextra -Werror and fix every warning.
  • Include stdio.h before using printf.

In plain English

The compiler translates each source file into an object file and the linker combines them into an executable. Types describe size and representation. Integer overflow and implicit conversions are your responsibility, not the runtime’s.

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

int main(void) {
    int32_t minutes = 12;
    double rating = 4.8;
    printf("%d minute lesson, %.1f rating\n", minutes, rating);
    return 0;
}
Your turn

Print a lesson summary

Easy

Print "HTML: 8 lessons" using an int and a string.

C · starter
int lessons = 8;
printf("TODO");
Check your understanding before moving on.
Knowledge checkQuestion 1

What does the linker do?

Select an answer to continue
Study tools

Make it yours.

Keep a private note for this lesson, then turn the key ideas into flashcards you can revisit.

Sign in to save notes and flashcards.Both are private to your account and stay with your progress.
Sign in
Finished reading?

Lock in what you just learned.

Mark this lesson complete to save your place and move one step closer to the certificate.

Next: Pointers and arrays
Lesson 6 of 300 · 0% of course