CSS Computer Science (Optional) — Paper-I, Section-A, Topic II subtopic. Three closely related, heavily-tested memory concepts.
int marks[5] = {90, 85, 78, 92, 88}; // marks[0] = 90 ... marks[4] = 88
int matrix[3][4]; — 3 rows, 4 columns, stored row-major in memory (all of row 0, then all of row 1, ...)marks[10] on a 5-element array) is undefined behavior in C/C++ — no automatic bounds checkingint x = 10;
int *p = &x; // p now holds the address of x
*p = 20; // dereference: changes x to 20, via p
& — address-of operator, gets a variable's address* — dereference operator, accesses/modifies the value at an address (context-dependent: also used to declare a pointer)p + 1 advances the pointer by sizeof(type) bytes, not by 1 byte — e.g. on an int*, p+1 moves 4 bytes ahead to the next intint **pp = &p; — a pointer that stores the address of another pointer, common in dynamic 2D arrays and passing pointers by reference to functionsNULL/nullptr, pointing to nothing — always check before dereferencing to avoid a crashmarks behaves like &marks[0]marks[i] is equivalent to *(marks + i) — array indexing is really pointer arithmetic in disguisesizeof(marks) gives the whole array's size; sizeof(pointer) gives just the pointer's size (e.g. 8 bytes on a 64-bit system) — a classic exam trap