← Back to C Course | Chapter 1: Introduction & Basics | Lesson 1 of 21

C Introduction

What is C?

C is a general-purpose, procedural programming language built around functions and statements rather than objects. It gives you fine control over how a program uses memory and the CPU, which is why it still underlies so much of the software you use every day without seeing it.

Example: What is C?

c
#include <stdio.h>
int main() {
	int total = 0;
	for (int i = 1; i <= 5; i++) {
		total += i;
	}
	printf("Total: %d", total);
	return 0;
}

Why Learn C?

Learning C forces you to understand what's actually happening under the hood -- how variables occupy memory, how a program is compiled into machine instructions, and how a CPU executes them one at a time. That mental model carries over directly into languages like C++, Java, and even Python.

Example: Why Learn C?

c
#include <stdio.h>
int main() {
	int x = 10;
	printf("Value: %d, Size in memory: %zu bytes", x, sizeof(x));
	return 0;
}

How C Works

A C program is first translated by a compiler into an intermediate object file, then linked into a native executable containing raw machine instructions. Unlike interpreted languages, there's no runtime translating your code as it runs -- the CPU executes your logic directly.

Example: How C Works

c
#include <stdio.h>
int main() {
	printf("This program runs as compiled machine code, no interpreter needed.");
	return 0;
}

Applications of C

Operating system kernels (Linux, parts of Windows), database engines like SQLite and PostgreSQL's core, and most other language runtimes are themselves written in C, because it gives predictable performance with almost no hidden overhead.

Example: Applications of C

c
#include <stdio.h>
int main() {
	printf("C powers OS kernels, database engines, and language runtimes.");
	return 0;
}

Benefits of C

Because C compiles to native code and lets you manage memory manually with pointers, programs written in it tend to be faster and use less RAM than equivalent code in higher-level languages -- at the cost of you being responsible for that memory yourself.

Example: Benefits of C

c
#include <stdio.h>
int main() {
	int value = 100;
	int *ptr = &value;
	printf("Direct memory control via pointer: %d", *ptr);
	return 0;
}

Login to run this code

C/C++/Java/PHP execution requires a free account. Your code is saved — you'll land right back in the editor after logging in.