What is C?
C is a general-purpose, procedural programming language developed by Dennis Ritchie at Bell Labs in 1972. It's one of the most influential programming languages ever created.
Why Learn C?
- Foundation: Understanding C helps you understand how computers work
- Performance: Compiles to efficient machine code
- Portability: Available on virtually every platform
- Influence: Syntax influenced C++, Java, JavaScript, C#, and many others
- Systems Programming: Operating systems, embedded systems, drivers
Key Characteristics:
- Low-level memory access via pointers
- Manual memory management
- Minimal runtime overhead
- Direct hardware access
- Small standard library
Where C is Used:
- Operating systems (Linux, Windows kernel)
- Embedded systems and IoT
- Game engines
- Database engines
- Compilers and interpreters
Code Examples
Hello Worldc
#include <stdio.h>
int main() {
// Print to console
printf("Hello, World!\n");
// Variables must be declared with types
int age = 25;
float height = 5.9;
char grade = 'A';
// Formatted output
printf("Age: %d\n", age);
printf("Height: %.1f\n", height);
printf("Grade: %c\n", grade);
// String (character array)
char name[] = "C Programming";
printf("Learning: %s\n", name);
return 0; // Success exit code
}C uses printf for formatted output with format specifiers: %d for int, %f for float, %c for char, %s for string.
Quick Quiz
1. Who created the C programming language?
2. What does the #include directive do?
Was this lesson helpful?