A program is a set of instructions that asks a computer to solve a problem. A beginner-friendly way to think about programming is this: computers do not understand natural human language. Even a request as simple as “calculate 1 + 2” must be written as precise executable steps.
At the lowest level, computers process binary information represented with 0 and 1. A programming language helps turn human intent into structured instructions. You write source code, a C compiler turns it into object code, and the operating environment loads and executes the resulting program.
Common mainstream programming languages include:
- Python: beginner-friendly and widely used for data analysis, AI, automation, and web backends.
- C: closer to low-level computer systems, often used for operating systems, embedded systems, and performance-sensitive programs.
- C++: extends C with more abstraction, and is common in game engines, high-performance computing, and large software systems.
- Java: widely used in enterprise backends, Android development, and large cross-platform systems.
- JavaScript / TypeScript: central to web frontends, and also used for backend and full-stack development.
- Go, Rust, and C#: common in cloud services, systems programming, game development, and enterprise applications.
These languages differ in syntax, use cases, and learning curve, but they share the same basic goal: turning human ideas into precise instructions a computer can execute.
What is a program?
Most programs combine four basic kinds of action:
- Input: receive data from a keyboard, file, network, or another source.
- Processing: calculate, compare, transform, or store data.
- Output: display a result, write a file, or send data somewhere else.
- Control flow: decide what runs first, what repeats, and what only runs when a condition is true.
When learning C, you do not need to master every syntax rule immediately. First build this mental model: a program is a clear sequence of steps, and the computer follows those steps exactly.
Flowchart
A flowchart is a visual way to describe program steps before writing code.
The flowchart below describes how to sum integers from 1 to 100. Notice the diamond-shaped node: it represents a decision. If the condition is true, the program keeps adding; if it is false, the program prints the result and stops.
In code, this becomes initialization, a loop condition, accumulation, variable update, and final output.
#include <stdio.h>
int main(void) {
int i = 1;
int total = 0;
while (i <= 100) {
total = total + i;
i = i + 1;
}
printf("%d\n", total);
return 0;
}KNOWLEDGE QUIZ
Your first C program
Hello World is usually the first program in a new language. Its job is simple: print a piece of text to the screen.
#include <stdio.h>
int main(void) {
printf("Hello World!\n");
return 0;
}Output:
Hello World!There are three details to notice right away:
printfis C’s standard formatted-output function.- The
mainfunction is the entry point of a C program. "Hello World!"is a string. A string is text, and text values are wrapped in quotes.
Read the key statement as: “call printf, display Hello World!, and then end the line.”
The structure of a C program
Different languages use different syntax, but the purpose is the same: display text on the screen. This comparison highlights C’s header, main function, and statement terminators.
print("Hello World!")#include <iostream>
using namespace std;
int main() {
cout << "Hello World!" << endl;
return 0;
}public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello World!");
}
}Compared with Python’s one-line output, C declares library functions through a header and starts execution in main; printf writes formatted data to standard output.
KNOWLEDGE QUIZ
Comments
Comments are notes for humans. They are not executed as program instructions. Use comments to explain intent, record context, or mark a point that future readers should understand.
Common C comment styles:
- Single-line comments start with
//. - Multi-line comments are wrapped in
/* ... */.
printf("Hello World!\n"); // display "Hello World!"More comments are not always better. For beginners, a good rule is to comment why something is done, not merely repeat what the line already says.
KNOWLEDGE QUIZ
Print a three-line learning card
Write a tiny runnable C program that prints three lines with printf(), and add one comment explaining the purpose of one line.
- Print a greeting on line 1, for example "Hello, Leaflet!".
- Print the course you are studying on line 2, for example "C Basics".
- Print one learning goal on line 3, for example "I want to write conditionals".
- Add one single-line comment that starts with // above any line.