In C, which of the following is TRUE about arrays and pointers?
2026
In C, which of the following is TRUE about arrays and pointers?
Answer: C. array[i] is equivalent to *(array + i) — Concept: In C, an array and a pointer are distinct types with independently-determined storage sizes and different lvalue properties, but the language…
- A.
sizeof(array)is always equal tosizeof(pointer) - B.
Array name can be incremented
- C.
array[i]is equivalent to*(array + i) - D.
None of these
Attempted by 64 students.
Show answer & explanation
Correct answer: C
Concept: In C, an array and a pointer are distinct types with independently-determined storage sizes and different lvalue properties, but the language standard defines certain array operations directly in terms of pointer arithmetic. Three governing rules matter here: (1) sizeof (C11 §6.5.3.4) applied to a fixed-size array name yields the array's own total size — element count × element size — computed from its declared type, never a pointer's size; (2) an array name used in an expression decays into a pointer to its first element (C11 §6.3.2.1; except as the operand of sizeof or unary &), but that decayed value is not a modifiable lvalue, so it cannot be the operand of ++; (3) the standard's subscript-operator rule (C11 §6.5.2.1) defines E1[E2] as identical to *((E1) + (E2)) whenever one operand has pointer-to-object type and the other has integer type.
Application: Trace each rule against a concrete declaration, int arr[5]; int *p = arr;:
sizeofcheck:sizeof(arr)= 5 ×sizeof(int)= 20 bytes on a typical platform, computed from the array's own type;sizeof(p)= the pointer's fixed size (commonly 8 bytes on a 64-bit build), computed from the pointer's own type — these are two independent computations, so an array's total size is not guaranteed to match a pointer's size (though for a specific array length and platform the two byte counts could coincidentally match; the standard gives no such guarantee, unlike rule 3 below).Increment check:
arrdecays to a pointer value only when used in an expression, and that decayed value is not a modifiable lvalue, so the compiler rejectsarr++; the independently declared pointerp, by contrast, is a genuine modifiable lvalue, sop++is accepted and simply advancespby oneintwidth.Subscript-identity check: by the standard's own definition,
arr[i]unfolds to*((arr) + (i)), i.e.*(arr + i), for every valid indexi— a textual grammar definition mandated by the language, not a coincidence of a particular compiler.
Cross-check: Plug in a second, independent index to confirm the identity from rule 3: for i = 0, arr[0] and *(arr + 0) (which is *arr) both name the first element — the same equivalence holds at every index, matching the standard's unconditional grammar definition rather than depending on any particular i. Rules 1 and 2 similarly hold at every platform and index: an array's total size is never mandated to equal a pointer's size, and a decayed array name is never a modifiable lvalue, regardless of array length or platform.
Result: The statement that is TRUE about arrays and pointers in C is that array[i] is equivalent to *(array + i) — a mandated grammar definition in the C standard (C11 §6.5.2.1), independent of platform, compiler, or the specific index used.