arrow
arrow
arrow
Which of the following C statements can also be used in place of num[i]? (i) *(num + i ) (ii) i[num] (iii) *(i+num)
Question

Which of the following C statements can also be used in place of num[i]?
(i) *(num + i )
(ii) i[num]
(iii) *(i+num)

A.

Only (ii)

B.

(i), (ii) and (iii)

C.

Only (i)

D.

Only (iii)

Correct option is B

In C language, the expression num[i] is defined as *(num + i).

Due to commutativity of addition, num + i and i + num represent the same memory address. Therefore, *(i + num) is also equivalent to num[i].
Additionally, the syntax i[num] is valid because array subscripting in C is defined as a symmetric operation — meaning a[b] is identical to b[a].

Hence, all three — *(num + i), i[num], and *(i + num) — produce the same result as num[i].

Important Key Points:

  1. In C, the array subscript operator [ ] is defined as *(base + index).
  2. The expression num[i] and i[num] are functionally identical.
  3. Both pointer arithmetic and array indexing ultimately reference the same memory address.

Knowledge Booster:

  • Only (ii): Incorrect because (ii) is valid, but excluding (i) and (iii) is wrong — they are also equivalent.
  • Only (i): Incorrect since (ii) and (iii) yield the same outcome.
  • Only (iii): Incorrect because (i) and (ii) are equally valid representations of num[i].

Free Tests

Free
Must Attempt

MPTET Varg 3 PRT Mock 01

languageIcon English
  • pdpQsnIcon150 Questions
  • pdpsheetsIcon150 Marks
  • timerIcon150 Mins
languageIcon English
Free
Must Attempt

MPTET Varg 3 PRT CDP Subject Test 01

languageIcon English
  • pdpQsnIcon20 Questions
  • pdpsheetsIcon20 Marks
  • timerIcon20 Mins
languageIcon English
Free
Must Attempt

UPTET Paper 2 Social Science : PYP Held on 23rd Jan 2022 (Shift 2)

languageIcon English
  • pdpQsnIcon150 Questions
  • pdpsheetsIcon150 Marks
  • timerIcon150 Mins
languageIcon English
test-prime-package

Access ‘UPSSSC’ Mock Tests with

  • 60000+ Mocks and Previous Year Papers
  • Unlimited Re-Attempts
  • Personalised Report Card
  • 500% Refund on Final Selection
  • Largest Community
students-icon
383k+ students have already unlocked exclusive benefits with Test Prime!
Our Plans
Monthsup-arrow