C Foundations · 8 min read · Intermediate
Hello C, Types & printf
Write your first compiled C program, declare strongly typed variables, and format output with printf.
What you'll learn
- Understand #include <stdio.h>, int main(void), and return 0
- Declare int, double, and char variables with explicit types
- Format output cleanly using %d, %.2f, and %s in printf
C is a compiled, statically typed systems language designed for speed and direct hardware control. Every C program starts executing in main(), and returning 0 signals success to the operating system.
Core Types & Format Specifiers
int->%d(signed integer, typically 32-bit)double->%for%.2f(double-precision floating-point)char->%c(single ASCII byte)const char *->%s(null-terminated string)
Fill-in-the-Blank Exercise
Include stdio & Print an Integer
Include the standard I/O header and print the integer variable score.
#include <>
int main(void) {
int score = 95;
printf("Score: \n", score);
return 0;
}Interactive Code Lab
Chello.c
Expected OutputClick “Run Live” to compile with GCC 13 (C11)
Track: C11 Lessons: 6 (16.7% done)
Check Your Understanding
Score: 0 / 1
1. What does returning 0 from main() signal to the operating system?
Study Workspace
Finished this lesson?
Your progress is saved locally in your browser, no account needed.