8.7k views
2 votes
Sptr is a pointer pointing to the beginning of an array called sarray. To access the value in sarray[3] by using the pointer, you would use:a) *sptr[*3] b) *sptr+3 c) sptr +3 d) *(sptr + 3)

User Bappi
by
6.5k points

1 Answer

5 votes

Answer:

The correct option for accessing the value in sarray[3] is : d) *(sptr+3)

Step-by-step explanation:

a) *sptr[*3] is wrong option because its syntax is not right it will give errors.

b) *sptr+3 is also wrong option because it will add 3 to the value of sarray[0].

c) sptr+3 is wrong option because it will only access the address of sarray[3] not the value it contains.

d) *(sptr +3) is correct syntax for accessing value in sarray[3] by using pointer

User Sola
by
7.4k points