1/21
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No analytics yet
Send a link to your students to track their progress
Strings: The “Null” Terminator
Is a special character used in C to mark the end of a string.
C strings are NOT their own (BLANK); they are just (BLANK) of (BLANK).
data type; array; characters.
Without the (BLANK) functions like (BLANK) or (BLANK) would not know where the string (BLANK), leading to (BLANK)
null terminator (‘\0’); printf; strlen; ends or “stops”; undefined behavior or “garbage” behavior — program crashes
A (BLANK) is a variable that stores the (BLANK) of another variable rather than a (BLANK)
Pointer; memory address; direct value
Dereferencing
Using the asterisk (*) operator to access or modify the value stored at the address the pointer is holding
Address-of Operator
Using the ampersand (&) to retrieve the memory address of a standard variable
Stack Memory
Memory managed automatically by the complier. It stores local variables and functions calls. It is fast but small and fixed in size.
Heap Memory
Memory managed manually by the programmer using malloc or calloc. It is much larger and flexible but slower to access.
Memory Leak
A condition where a program allocates memory on the heap but fails to free() it before the pointer is lost, wasting system resources
Pass by Reference
A method of passing arguments to a function where the address of the variable is passed instead of a copy of its value.
True or false; pass by reference allows a function to modify the original variable's value in the calling function (like main).
True
A (BLANK) is a (BLANK) that allows you to group variables of a different types (heterogenous data) under a single name.
Struct(structure); user-defined data type;
True or False; Like an Array (which holds the same type of data), a struct can not hold a char, an int, and a float all at once.
False
argc (Argument count)
An integer representing the number of arguments passed to the program from the command line (including the program name itself)
argv (Argument rector)
An array of strings (pointers to characters) where each string is one of the arguments passed
Calloc
Allocates memory and initializes all bytes to zero.
Malloc
Allocates a block of uninitialized memory (contains “garbage” values).
The FILE Pointer
FILE * is a specific data type (a structure) used by C to keep track of a file’s “state” (where you are currently reading or writing in that file)
Opens an existing file. Crucial: If the file does not exist, fopen returns null
mode “r” (Read)
Creates a new file. Crucial: If the file already exists, it contents are overwritten (deleted) immediately
mode “w” (write)
A definition for a special constant that signals when there is no more data to read from a file
EOF (End of File)