0
0
Cprogramming~5 mins

Writing first C program - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is the purpose of the #include <stdio.h> line in a C program?
It tells the compiler to include the Standard Input Output library, which allows the program to use functions like printf() to display text on the screen.
Click to reveal answer
beginner
What does the int main() function represent in a C program?
It is the starting point of the program where execution begins. The program runs the code inside main() first.
Click to reveal answer
beginner
Why do we use return 0; at the end of the main() function?
It tells the operating system that the program finished successfully. Returning 0 usually means no errors happened.
Click to reveal answer
beginner
What does the printf() function do?
It prints text or variables to the screen so the user can see output from the program.
Click to reveal answer
beginner
Why do we put a semicolon ; at the end of most lines in C?
The semicolon tells the compiler that the statement is finished, like a full stop in a sentence.
Click to reveal answer
What is the correct way to start the main function in a C program?
Avoid main()
Bstart()
Cint main()
Dfunction main()
Which header file is needed to use printf()?
A<stdlib.h>
B<stdio.h>
C<string.h>
D<math.h>
What does return 0; mean in the main() function?
AProgram ended with no errors
BProgram has an error
CStart the program
DPause the program
Which symbol ends a statement in C?
A,
B.
C:
D;
What will this code print? <br>
printf("Hello, World!\n");
AHello, World!
BHello World
CHello, World!\n
DError
Explain the basic structure of a simple C program that prints text on the screen.
Think about what each part does and how they work together.
You got /5 concepts.
    Why is the main() function important in every C program?
    Consider what happens when you run a C program.
    You got /3 concepts.