Which of the following is the correct way to initialize an array?

Which of the following is the correct way to initialize an array?

  1. A.

    int num[6] = (2, 4, 12, 5, 45, 5)

  2. B.

    int num[ ] = {2, 4, 12, 5, 45, 5}

  3. C.

    int num{6} = {2, 4, 12}

  4. D.

    int num(6) = {2, 4, 12, 5, 45, 5}

Attempted by 947 students.

Sign up free to check your answer

Sign up free

Explore the full course: Nta Ugc Net Paper 2

Loading lesson…