C Exercises

Fill in the blanks to test your knowledge.

1

Include the standard I/O header

<stdio.h>
2

Declare an integer variable called score

score = 100;
3

Print a string to stdout

("Hello, World!\n");
4

Declare a pointer to an integer

int ptr = &score;
5

Dereference a pointer to get its value

int val = ptr;
6

Write a for loop that runs 5 times

(int i = 0; i < 5; i++) {
printf("%d\n", i);
}
7

Return 0 from the main function

int main() {
printf("Hi");
0;
}
8

Declare a character variable

grade = 'A';