Every C program, whether it is a simple 'Hello World' or a complex operating system code, follows a strict, predefined structure. Understanding this structure is the very first step in learning the C programming language.
C is a case-sensitive language. This means Main(), MAIN(), and main() are treated as completely different words. The starting function must be strictly lowercase: main().
A standard C program is divided into the following sections:
// or /* ... */.#include <stdio.h> that tell the compiler to link standard library files before compiling.main() Function: The absolute starting point of every C program. Execution always begins here.// 1. Documentation: My First C Program
#include <stdio.h> // 2. Preprocessor Directive
int globalVar = 10; // 3. Global Declaration
int main() { // 4. Main Function
printf("Hello, World!\n");
return 0;
}
#include <stdio.h>: Stands for Standard Input Output. It contains functions like printf() and scanf().{ } (Curly Braces): These define the start and end of a block of code (the body of the function).; (Semicolon): Every single statement in C must end with a semicolon. It is like a full stop in English.return 0;: Tells the operating system that the program has finished executing successfully.No. The `main()` function is absolutely mandatory in C. Without it, the compiler will throw an error because it does not know where to start executing the code.
Top 20 Computer Related Full Forms for Exams
A complete list of the most important computer-related full forms. Learn the full forms of CPU, RAM, ROM, HTTP, USB, and GUI for basic computer exams.
Computer Science Class 12 Syllabus Overview
Explore the CBSE Computer Science Class 12 syllabus. Learn about Python programming, SQL databases, and computer networks essential for board exams.
Control Statements in Java: Types and Examples
Learn about the three types of control statements in Java: Decision making (if-else), Iteration loops (for, while), and Jump statements (break, continue).
What is Control+Z Used For?
Learn what the Ctrl+Z keyboard shortcut is used for. Discover how the 'Undo' function works in word processing, photo editing, and file management.
What is the Full Form of CRT?
Discover the full form of CRT in computer hardware. Learn how the heavy, bulky Cathode Ray Tube monitors worked before flat LCD screens existed.
Turn this guide into revision flashcards, a practice exam, or an AI-generated podcast โ free, no signup required.