Arrays and Pointers in C Formula Sheet: Address Rules and Revision Notes
Revise C arrays and pointers through compact identities, exact address traces, operator parsing, decay traps, and a practical retrieval routine.
KnowledgeGate Team
Exam prep & CS education

Array notation and pointer notation often produce the same numerical address, which makes revision deceptive. Their types, strides and legal operations are still different, so a familiar-looking expression can hide an invalid step. Use CS Fundamentals as the broader subject route. The key retrieval rules are one-dimensional and two-dimensional address formulas, pointer precedence, and boundary checks; rebuild them from the traces instead of memorising isolated symbols.
1. Arrays in C: the five identities worth memorising
Start with:
int a[5] = {7, 11, 13, 17, 19};N = sizeof a / sizeof a[0], with valid indices0throughN-1. Use it only on a complete array.a[i] = *(a + i)and&a[i] = a + i. Use these when syntax mixes subscripting, addresses and dereferencing.For a pointer
pinto the array,p[i] = *(p + i). Use it to expand pointer subscripting before tracing.
In most expressions, a converts to a pointer to its first element. It stays an array under sizeof and unary &. The name is not a modifiable lvalue, so a++ and a = p are invalid. The earlier Arrays and Pointers in C: Memory, Arithmetic, Traps owns the first-pass memory model, 2D derivation and precedence walkthrough; this sheet keeps the compact identities and revision checks.
2. Pointer arithmetic in C: scale by the pointed-to type
The teaching formula is address(p + k) = address(p) + k * sizeof(*p). Use it when converting an element offset into a byte address.
If p = &a[i], then p + k = &a[i+k] within the same array or at its one-past position. You may form and compare one-past, but never dereference it. Apply this bound rule before reading an address.
If q = &a[j] and p = &a[i] share an array, q - p = j - i. Use subtraction to count elements, not bytes; the result is ptrdiff_t. Unrelated arrays define no such distance.
An int * advances by one int, while an int (*)[5] advances by one complete five-int row. Parse the pointed-to type before tracing an offset.
3. Arrays and pointers worked example: one base address, eight results
Assume the invented model sizeof(int) = 4 bytes and base B = 1000. Round addresses make scaling visible. The earlier Relationship Between Arrays and Pointers in C owns the conceptual type distinction and its single-base memory strip; this sheet uses a separate five-value trace to make the formulas and operator checks retrievable.
int a[5] = {7, 11, 13, 17, 19};
int *p = &a[1];
int *q = &a[4];Result | Step-by-step calculation |
|---|---|
Array size |
|
Element count |
|
|
|
| Address |
|
|
|
|
|
|
|
|
Use it to keep the base consistent. a + 5 is int *; &a + 1 is int (*)[5]. Both equal 1020 here, with strides 4 and 20 bytes. Equal addresses do not erase types.

4. Two-dimensional arrays in C: row-major formula and address trace
Take int m[3][4] = {{2,4,6,8}, {10,12,14,16}, {18,20,22,24}};. Assume base B = 2000, sizeof(int) = 4, rows R = 3 and columns C = 4.
For valid zero-based indices, &m[i][j] = B + (i * C + j) * sizeof(int). Use this formula to flatten a row-major position into its element offset. Therefore:
&m[2][1] = 2000 + (2 * 4 + 1) * 4 = 2000 + 36 = 2036, and m[2][1] = 20.
Now trace the types. m converts to int (*)[4]. Thus m + 2 reaches row 2 at 2000 + 2 * 16 = 2032. Then *(m + 2) converts to an int * at 2032; adding 1 reaches 2036. Hence m[2][1] = *(*(m + 2) + 1) = 20. Use this expansion when a 2D subscript is mixed with pointer notation.
In void f(int m[][4]), the parameter adjusts to int (*m)[4]. The trailing dimension remains because the compiler needs the four-column row stride.
![Three-by-four C matrix at base address 2000 with row-major addresses, highlighting m[2][1] = 20 at address 2036.](https://cdn.knowledgegate.ai/blog-assets/blog_asset_1786748275166_6jcw38.jpg)
5. Pointer expressions in C: parse four operators before tracing them
Reset this fresh state before each independent case:
int a[5] = {7, 11, 13, 17, 19};
int *p = &a[1];
int x;Expression | Parenthesised form |
|
| Array change |
|---|---|---|---|---|
|
|
|
| None |
|
|
|
|
|
|
|
|
| None |
|
|
|
|
|
Parenthesise postfix and prefix operators first, then separate pointer movement from pointee modification. In *p++, postfix ++ moves the pointer after reading its old pointee. In (*p)++ and ++*p, the pointer stays fixed while the pointee changes. Never infer a result from visual proximity.
6. Arrays and pointers traps: decay, declarations, bounds and lifetime
In a separate 64-bit model, sizeof(int *) = 8 and sizeof(int) = 4. void f(int a[5]) adjusts to int *a; inside, sizeof a / sizeof a[0] = 8 / 4 = 2, not caller length 5. The earlier Arrays and Strings in C: Decay, sizeof and 2D Addresses owns string sentinels, sizeof comparisons and the full row-major derivation; this sheet keeps the compact decay formula beside its declaration and lifetime traps.
Read from the identifier outwards. int *ap[5] is an array of five pointers to int. int (*pa)[5] = &a is one pointer to an array of five int; under the earlier model, pa + 1 advances 20 bytes.
Trap | Result | Correction |
|---|---|---|
Dereference | Out of bounds | Never dereference one-past |
Subtract unrelated pointers | No valid distance | Use one array only |
Dereference null, uninitialised or dangling pointers | Invalid access | Point to a live object |
Modify through | String-literal modification | Use |
Assign one array to another | Invalid whole-array assignment | Copy elements explicitly |
7. GATE arrays and pointers questions: a 90-second solving method
Common practice-question forms ask you to compute an element address, distinguish an array from a pointer or pointer-to-array, expand a subscript, trace pre-increment and post-increment, calculate a row-major address, check a bound, or identify an invalid dereference or lifetime error.
Use this six-step routine:
Write every exact type.
Mark whether array-to-pointer conversion occurs.
Record base
B, element sizew, row width and valid bounds.Expand
x[i]to*(x + i).Parenthesise
++,--and*before tracing state.Reject a one-past dereference, unrelated-pointer subtraction, null access or dangling access before calculating output.
KnowledgeGate's C Programming > Arrays & Pointers question bank provides practice depth; it is not evidence of exam weightage, frequency or any official pattern. The scheduled Arrays and Pointers in C: 7 GATE Mistakes That Cost Marks owns the seven error-first corrections; this sheet stays with formulas, derivations and a compact operator table.
8. Arrays and pointers revision notes: the short version and next step
Subscripting is pointer addition followed by dereference.
Pointer arithmetic scales by the pointed-to type.
Pointer subtraction counts elements within one array.
A one-past pointer may be formed, but not dereferenced.
sizeofsees a real array only before parameter adjustment.A 2D array decays to a pointer to its first row.
In ten minutes, rebuild the five-cell map from 1000. Recover 1012, 1020 and q - p = 3, then recompute m[2][1] at 2036 unseen. For broader study, continue with the C Language course.
Keep learning
Relationship Between Arrays and Pointers in C: Decay, Address Arithmetic and a Worked Memory Trace
See why an array is not a pointer, even when their displayed addresses match. Trace decay, pointer movement, sizeof, function parameters and bounds through one C array.
C Fundamentals Formula Sheet for GATE CS: Rules, Traces and Revision Notes
Revise the C rules that most often change an answer. Use compact tables, worked traces, address formulas, memory notes, and a practical error checklist.
Storage Classes, Structures and Enums in C: Formula Sheet with Worked Revision
Revise C declarations through three separate axes, then test them with a two-call trace, a byte-layout calculation and an enum sequence.
DMA, Macros, Scoping and File Handling in C: Formula Sheet with Worked Revision Notes
Build a compact C revision sheet for dynamic memory, macros, scope, linkage, storage duration and file streams. Four worked checks connect each rule to an exact result.





