Section One - C Primer Flashcards
Daemons
Program with no GUI and run in the background.
command line tools
Programs that run for a short time in terminal.
Function
A list of instructions for computer to execute.
Variable
Place where data is stored.
short, int, long
These three types are whole numbers.
float, double
Floating point number – a number that can have a decimal point.
char
One byte integer that we usally treat as a character.
pointers
A Pointer holds a memory address. Declared using a asterisk.
struct
A struct is a type made up of other types.
if/else
if (conditional) { // execute this code if the conditional evaluates to true } else { // execute this code if the conditional evaluates to false }
“==”
Are they equal?
“!=”
Are they not equal?
&&
Logical AND – true if and only if both are true.
||
Logical OR – false if and only if both are true.
!
Logical NOT – true becomes false, false becomes true.
boolean variable
A variable that can be true or false. BOOL someVarName =
else if
if (truckWeight <= 0) { printf("A floating truck\n"); } else if (truckWeight < 40000.0) { printf("A light truck\n"); } else { printf("A heavy truck\n"); }
conditional (ternary) operator
int minutesPerPound = isBoneless ? 15 : 20;
function frame
Think of frame as a blackboard that you scribble on while function is running.
stack
is a place in the computer memory where all the variables that are declared and initialized before runtime are stored.
Automatic values – variables are automatically destroyed when function ends.
heap
is the section of computer memory where all the variables created or initialized at runtime are stored.
three memory segments
text (code) segment
stack segment
heap segment
recursion
a function that calls itself.
static variable
A variable with static storage duration has a permanent storage location. It retains its value throughout the execution of the program. Only accessible from the code in the file it was declared.