
Day 2 Recap Questions
- The command to compile a C program is
gcc <source file> -std=c99 -pedantic -Wall -Wextra
. Use man
or Google to find out the meaning of the four flags, i.e. -std=c99
, -pedantic
, -Wall
and -Wextra
.
- Once you’ve compiled a C program using the previous command line instruction, how do you run it?
- Briefly describe what a preprocessor, compiler and linker do when transporting C code into executable?
- What does it mean when a C program ends with the statement
return 0;
?
- Why do we use the directive
#include <stdio.h>
?
- In the context of using
printf
, what are format specifiers? How do we use them? What are some of the most common specifiers?
- What function from
stdio.h
can we use to read input? What special symbol do we use in front of the variable argument to this function? What is the return value of this function?
- What does an undefined behavior mean in programming? Do we need to care about it? Why or why not?
- What does the modifier
const
mean?
- What are the primitive types in C and what are their byte sizes?
- What is the value of
7 / 2
(a division of two integers) in a C program?