C - Hello, World Flashcards
What are the 3 general steps in creating an executable?
- Preprocessing
- Compiling
- Linking
What is preprocessing?
Before code is compiled it is given to a program called the preprocessor. The preprocessor edits and manipulates code, setting it up for the compiler. Typically the preprocessor looks for lines that begin with # and alters the code based on these directives.
What is compiling?
Preprocessed code is given to the compiler, a program that translates C statements into machine instructions.
What is linking?
A linker combines the object code produced by the compiler with any additional code needed to create a complete execuatable. This additional code includes things like library functions.
What are the three fundamental language features that C relies on?
- Directives
- Fuctions
- Statements
What is a function?
A series of statements grouped together and given a name
What does main return?
An integer status code
How do you start all c programs?
include
int main(void)
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 variable