Concept Flow - Structure of a C program
Start
Include Headers
Define main() Function
Declare Variables
Write Statements
Return from main
End
This flow shows the basic parts of a C program from start to finish.
#include <stdio.h> int main() { printf("Hello, world!\n"); return 0; }
| Step | Code Line | Action | Output/Result |
|---|---|---|---|
| 1 | #include <stdio.h> | Include standard input/output library | No output |
| 2 | int main() { | Start main function | No output |
| 3 | printf("Hello, world!\n"); | Print text to screen | Hello, world! |
| 4 | return 0; | Return 0 to OS (program success) | No output |
| 5 | } | End main function | Program ends |
| Variable | Start | After Step 3 | Final |
|---|---|---|---|
| No variables | N/A | N/A | N/A |
#include <stdio.h> // Include library for input/output
int main() { // Main function starts
printf("Hello, world!\n"); // Print text
return 0; // End program successfully
} // End of main