Nearby lessons

4 of 124

C - Features

The main features of the C language — simplicity, speed, portability, a rich set of operators, pointers for direct memory access, modularity, recursion, extensibility and a small but powerful standard library.

The Features at a Glance

FeatureWhat it means for you
SimpleA small language with only 32 keywords (C89) and a clear structure
Fast & efficientCompiles directly to machine code with almost no runtime overhead
PortableThe same source file compiles on Windows, Linux, macOS and microcontrollers
Rich operator setAround 45 operators, including bitwise operators most languages lack
PointersRead and write memory addresses directly
ModularSplit a program into functions and files that can be reused
ExtensibleAdd your own functions and libraries; the language never gets in the way
RecursionA function may call itself, which simplifies many algorithms
StructuredBlocks, loops and functions instead of goto spaghetti
Standard libraryReady-made functions for I/O, strings, maths, memory and files

Simplicity — Only 32 Keywords

The entire C89 language is built from just 32 reserved words. Compare that with well over 50 in Java and around 100 in C#. A small vocabulary means there is very little to memorise before you can read any C program.

Example02
CCode Cell
1#include <stdio.h>
2 
3int main()
4{
5 int i; // int - a keyword
6 for (i = 1; i <= 3; i++) // for - a keyword
7 {
8 printf("Line %d\n", i);
9 }
10 return 0; // return - a keyword
11}
Output
Line 1
Line 2
Line 3

Speed — Straight to Machine Code

There is no virtual machine and no interpreter between your code and the CPU. When you write a + b, the compiler emits a single addition instruction. Nothing is checked, boxed or garbage-collected at runtime.

In simple words: Python has to work out what your code means every time it runs. C worked that out once, at compile time, and threw the question away.

Portability — Compile Anywhere

C source code is not tied to one processor. Give the same .c file to a compiler on Windows, on a Linux server, or on an Arduino, and each one produces a working program for its own hardware.

Example04
CCode Cell
1#include <stdio.h>
2 
3int main()
4{
5 /* This same file compiles unchanged on Windows,
6 Linux, macOS and most microcontrollers. */
7 printf("Portable C\n");
8 return 0;
9}
Output
Portable C

Pointers — Direct Memory Access

Very few modern languages let you look at a variable's actual address. C does, and that is what makes it suitable for writing operating systems and device drivers:

Example05
CCode Cell
1#include <stdio.h>
2 
3int main()
4{
5 int age = 25;
6 int *p = &age; // p holds the ADDRESS of age
7 
8 printf("Value : %d\n", age);
9 printf("Address : %p\n", (void *) p);
10 printf("Via ptr : %d\n", *p);
11 return 0;
12}
Output
Value   : 25
Address : 000000000061FE14
Via ptr : 25

The Honest Limitations

C's power comes from what it leaves out, and that cuts both ways:

  • No automatic memory management — memory you allocate, you must free.
  • No array bounds checking — writing past the end of an array corrupts memory silently.
  • No exception handling — errors are reported with return values you must check.
  • No object-oriented features — no classes or inheritance (that is C++).
  • No built-in string type — strings are just arrays of char.
C trusts you completely. It will happily compile code that reads array element 100 of a 10-element array. The compiler will not warn you and the program may not crash — it will just print garbage. Careful coding is not optional in C.
📝 Key Takeaways
  • C is simple: only 32 keywords in C89.
  • It is fast because it compiles straight to machine code.
  • It is portable: the same source compiles on many machines.
  • Pointers give direct access to memory addresses.
  • It is modular and extensible — build big programs from small functions.
  • C gives you no garbage collector and no bounds checking; that is your job.

🧠 Test Your Knowledge

3 Questions
Progress: 0 / 3