Lectures 1 - 6 Flashcards
(19 cards)
Building a C program. First step:
(Source Code)
Pre-processor
Executes all the pre-processor directives
Compiler
Generates assembly code for one or more architectures
Assembler
Generates binary Object code
Linker
Links all objects with binaries and generates an executable.
C types
Unsigned integers, signed integers, floating point numbers.
char, short, int, long, and long long.
struct keyword
Structures are aggregates of basic data types
CPU
An electronic circuit in charge of control, logical, arithmetic and I/O operations
Arithmetic and Logical Unit (ALU)
Handles arithmetic, math, and bitwise operations
Control Unit (CU)
In charge of reading and writing in memory and directing the ALU
What does the Pre-processor do?
- Removes comments
- Directives, which always comes with a #. Checks if there are any replacements
- Pull in entire files
The pre-processor modifies the source code for the compiler.
What is a pointer?
A value that happens to be an address. Or a variable that stores the address of another variable.
Difference between * and *
- = Used to go from an address (pointer) to the value in that memory location.
&. The address-of operator, &, is used to create a pointer to a variable.
Pass by value (Option)
Copy the value to the function. An original and a copy that can be changed.
Pass by pointer (Option)
Stores the address of another variable
Pass by reference (Option)
Provide a reference to the value to the function.
Problem with Pass by value.
Expensive for large objects and uses extra memory.
The function can’t change the parameters
Problem with Pass by pointer.
Function might change them and could be an issue when calling library code.
Problem with Pass by reference.
Involves a dereference operation.