Concept Flow - Writing first C program
Start
Include stdio.h
Define main() function
Execute printf statement
Return 0
End program
This flow shows the steps of a simple C program: include library, define main, print message, return success, and end.
#include <stdio.h> int main() { printf("Hello, world!\n"); return 0; }
| Step | Code Line | Action | Output | Next Step |
|---|---|---|---|---|
| 1 | #include <stdio.h> | Include standard input/output library | 2 | |
| 2 | int main() { | Start main function | 3 | |
| 3 | printf("Hello, world!\n"); | Print text to screen | Hello, world! | 4 |
| 4 | return 0; | Return 0 to signal success | 5 | |
| 5 | } | End main function | Program ends |
| Variable | Start | After printf | Final |
|---|---|---|---|
| None | - | - | - |
#include <stdio.h> // Include input/output library
int main() { // Main function start
printf("Hello, world!\n"); // Print message
return 0; // End program successfully
}