What is the index of the first element in an array in C?

20242025

What is the index of the first element in an array in C?

  1. A.

    0

  2. B.

    1

  3. C.

    -1

  4. D.

    Undefined

Attempted by 1473 students.

Show answer & explanation

Correct answer: A

In C, array indexing starts from 0. That means the first element is accessed by array[0], the second by array[1], and so on. This is a fundamental concept in C programming, and different from some other languages like MATLAB where indexing starts from 1.

Explore the full course: Cocubes Preparation