1/31
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
Call Stack
A data structure that manages function calls, allowing for nested calls and handling local variables.
LIFO
Last In, First Out; a principle that describes the order of operations in stacks.
FIFO
First In, First Out; a principle that describes the order of operations in queues.
Pointers
Variables that store memory addresses, allowing for direct access to memory and manipulation of data.
Swap() Function
A function designed to exchange the values of two variables.
Array
A data structure that allocates a fixed-size sequence of elements of the same type.
Macro
A preprocessor directive in C that defines a code snippet to be replaced at compile-time.
Segmentation Fault
A runtime error that occurs when a program attempts to access memory not allocated to it.
Dereferencing
The process of accessing the value at the address stored in a pointer.
Function Arguments
Parameters passed to a function to provide input data for processing.
Static Variables
Variables that retain their value even after the function in which they were defined exits.
Address of Operator
The operator (&) in C that retrieves the memory address of a variable.
C Arrays vs Pointers
Arrays decay into pointers when passed to functions and lose size information.
Buffer Overflow
A vulnerability that occurs when data exceeds the buffer storage capacity.
Null Pointer
A pointer that does not point to any valid memory location.
Pointer Arithmetic
The act of performing arithmetic operations on pointer values to traverse memory addresses.
Function Return Type
The data type that a function returns after execution.
Double-Dereference
Accessing the value of a pointer that points to another pointer.
volatile
A keyword in C that tells the compiler not to optimize access to a variable, ensuring it reads the value from memory each time.
Value vs Reference Types
Value types hold data directly, while reference types store a reference to the data's memory location.
Dynamic Memory Allocation
The process of allocating memory at runtime using functions like malloc or calloc.
Function Scope
The visibility and lifetime of variables declared within a specific function.
2D Arrays
Arrays of arrays, allowing the representation of a grid or matrix structure.
Compile-time Error
An error detected by the compiler while translating code to machine language.
Types of Pointers
Different kinds of pointers include null pointers, void pointers, function pointers, and pointer to pointers.
Pointer Arithmetic Defined
Pointer arithmetic allows operations such as addition and subtraction to navigate through array elements via pointers.
Array Syntax in C
Arrays are declared using the syntax datatype arrayName[size], e.g., int myArray[10];
SWAP Using Pointers
To swap values using pointers, pass the addresses of the variables to a swap function, e.g., swap(&a, &b).
Swap Function Example
void swap(int *a, int *b) {
int temp = *a;
*a = *b;
*b = temp;
}
Using the Swap Function
int main() {
int x = 5, y = 10;
swap(&x, &y);
// x is now 10, y is now 5
}
Memory Address Retrieval Example
int a = 20;
int *p = &a; // p holds the address of a
Dereferencing Example
int value = *p; // Gets the value stored at the address in p, which is 20.