Table of Content
- Theoretical Concepts
- Core Concepts
Common Commands
Flag | Description |
---|---|
-Wall | Show warnings when potential errors are detected |
-W | Procedures additional error messages beyond -Wall |
-pedantic | Shows warnings when code does not follow the C standard |
-ansi | Disables features of GCC that aren’t in standard C (Not used with -std) |
-std=c89 | Specify which version of C should be used to check the program |
-O2 | Compiler optimization levels (0 -3) |
Expression and Statement
Expression
Something which evaluates to a value
Example: 1+2/x
They always return a value
Expressions can be in statements
Statement
A line of code that does something
Example: GOTO 100
They do not return a value (They are of type void
)
Statements cannot be used in expressions
VS Code C Formatting: Clang-Format Style Options
dvdmtw98: Solutions for exercises from “C Programming: A Modern Approach”
Miscellaneous Points
Arrays
Name of arrays in C stores the base address of the array
Library Files
To include the Math library (libm.a) in a program we need to specify the -lm
flag
.a
(Archive) are static library files and are embedded into our code .so
(Shared Object) are dynamic library files and are only referenced by our program