UGC-NET Jun 2013 · Arrays & Matrix Representation

MCQ · 2 marks · Problem PROG-DSTR-0070

Arrays in C language can have with reference to memory representation.
  1. A
    n-subscripts
  2. B
    two-subscripts
  3. C
    only one subscript
  4. D
    three subscripts only

Solve it on GATE DA practice →More Basic Data Structures problems

Show the worked solutionMemory is a linear sequence of addresses. A multi-dimensional C array is stored contiguously in row-major order, and every reference \(a[i][j]\) is converted to a single offset:\[\&a[i][j]=\text{base}+(i\cdot\text{cols}+j)\cdot\text{size}.\]So in its memory representation every C array is one-dimensional, i.e. has only one subscript, whatever the number of subscripts in the source code.Answer: C

GATE DA practice: past exam problems by chapter, with worked solutions · gatedaprep.com