C2: Introduction to C Flashcards
What does hosted implementation of C mean?
It means full support for standard libraries. this type of C is used on top of OS.
What is a freestanding implementation of C?
It means there is restricted library support. This is the case usually when C is run on hardware. ex: embedded systems
Why include a header file in a C program?
to use standard libraries
What are the steps for building C programs?
preprocessing, compiling, linking. (Using gcc usually executes all three steps automatically.)
in console:
>gcc -o hello hello.c
>./hello
What is pre-processing?
Pre-processing: processing directives,
modifying source file text
What is compiling?
Compiling: translating source code into machine instructions (object code)
What is linking?
Linking: combining object code created
by compiler with other code to create a
single executable program
What are comments?
They are text for documentation purposes and are mapped to whitespaces before preprocessing. (Neither pre-processor nor compiler sees them.)
What is a variable
it has a name, a type and a value. It can be assigned values, do calculations and in-/output variables
What is a function?
They are the basic means to avoid code duplication and to structure our program Cannot be nested, grouped, etc. main is a special function and the only mandatory one
What are control structures in C?
Two types: Selection • if statement • switch statement Loops • while loop • do while loop • for loop