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

C History & Features

History of C

Dennis Ritchie designed C at Bell Labs in 1972 as a tool for rewriting the Unix operating system, which had previously been written in assembly for each specific machine. C let Unix become portable across hardware for the first time.

Example: History of C

c
#include <stdio.h>
int main() {
	printf("C was created by Dennis Ritchie at Bell Labs in 1972.");
	return 0;
}

Direct Memory Access

Pointers let a variable store the memory address of another variable instead of a value directly, so you can read or modify data indirectly. This is what makes techniques like dynamic memory allocation and efficient array/string handling possible in C.

Example: Direct Memory Access

c
#include <stdio.h>
int main() {
	int value = 42;
	int *ptr = &value;
	printf("Address: %p, Value via pointer: %d", (void*)ptr, *ptr);
	return 0;
}

Speed and Efficiency

With no garbage collector, virtual machine, or interpreter layer between your code and the processor, a compiled C program spends its execution time doing actual work rather than managing runtime overhead -- one reason it's still chosen for performance-critical systems.

Example: Speed and Efficiency

c
#include <stdio.h>
int main() {
	long sum = 0;
	for (long i = 0; i < 1000000; i++) {
		sum += i;
	}
	printf("Sum: %ld", sum);
	return 0;
}

Modularity

C encourages breaking a program into small, independent functions, each handling one task and callable from anywhere in the file (or other files, via headers). This mirrors how larger real-world codebases stay maintainable as they grow.

Example: Modularity

c
#include <stdio.h>
int square(int n) {
	return n * n;
}
int main() {
	printf("Square: %d", square(5));
	return 0;
}

Extensibility

The standard library and third-party libraries expose reusable functionality -- string handling, math, file I/O -- through header files you #include, so you're not stuck rewriting common operations that other programmers have already solved well.

Example: Extensibility

c
#include <stdio.h>
#include <string.h>
int main() {
	char name[] = "C Language";
	printf("Length: %zu", strlen(name));
	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.