Q.Write the format of simple C program.
[!TLDR]
A simple C program has a #include line, the main() function header, and a body of statements inside braces.
The general format shows where each part of a minimal program goes: the preprocessor directive brings in the standard I/O header, main() marks the start of execution, and the body (between { and }) contains the variable declarations and the executable statements, each ending with a semicolon.
#include <stdio.h>
main()
{
// 1. declaration part - declare the variables used
// 2. statement part - input, processing and output statements
}
Execution always begins at main(). The opening and closing braces mark the boundary of the function body, and every statement inside is terminated by a semicolon.
[!ANSWER]
A preprocessor #include directive, then main() with its body of declarations and statements enclosed in braces { } - as shown above.
Unlock everything free for 14 days
- Full step-by-step solutions
- Concept-first explanations
- Methods, shortcuts & mistakes
- PYQ mapping + timed mock tests
Full access for 14 days. No credit card required.