645 views
5 5 votes

Which of the following expressions is NOT equivalent to ${ }^*(\operatorname{arr}+3)$ where arr is an integer array?

  1. $\operatorname{arr}[3]$
     
  2. *(&arr $[0]+3)$
     
  3. $* a r r+3$
     
  4. $*(3+a r r)$

1 Answer

4 4 votes
Ans: Option C

A) Correct,    $\text{arr}[i] = *(\text{arr} + i)$
B) Correct,    array name $(\text{arr})$ represents address of first element $\&\text{arr}[0]$

C) Incorrect,  $[*\text{arr} + 3]$ first dereferences to $\text{arr}[0]$ then we add 3. which doesn't match
D) Correct,    $\text{arr}[3] = 3[\text{arr}] = *(3 + \text{arr})$
Position:
Show:

Related questions

10 10 votes
2 2 answers
1.2k
1.2k views
GO Classes asked Jul 25, 2025
1,225 views
#include <stdio.h struct Point { int x, y; }; int main() { struct Point p1 = {10, 20}; struct Point *ptr = &p1; ptr->x += 5; (*ptr).y -= 10; printf("%d %d\n", p1.x, p1.y)...
9 9 votes
6 6 answers
997
997 views
GO Classes asked Jul 25, 2025
997 views
#include <stdio.h void fun() { static int count = 0; count++; printf("%d ", count); } int main() { for (int i = 0; i < 3; i++) fun(); return 0; }What is the output of the...
6 6 votes
1 1 answer
456
456 views
GO Classes asked Jul 19, 2025
456 views
Consider the following C code:int arr[] = {10, 20, 30, 40, 50}; int *p = arr + 2; printf("%d", *(p - 1));What is the output of this code? $10$  $20$  $30$  $40$
10 10 votes
2 2 answers
664
664 views
GO Classes asked Jul 25, 2025
664 views
Consider the following psuedocode fragment, where $y$ is an integer that has been initialized.int i=1 int j=1 while (i<10): j=j*i i=i+1 if (i==y): break end if end whileC...