Ana sayfa
/
Teknoloji
/
EXER CISE -5 int q p = stuff; Consider the code above. a) Write a statement using pointer variable p, that would be equivalent to stuff[4] b) Write a statement that would assign the address of the third element of stuff to pointer q

Soru

EXER CISE -5
int q
p = stuff;
Consider the code above.
a) Write a statement using pointer variable
p, that would be equivalent to stuff[4]
b) Write a statement that would assign the
address of the third element of stuff to
pointer q

EXER CISE -5 int q p = stuff; Consider the code above. a) Write a statement using pointer variable p, that would be equivalent to stuff[4] b) Write a statement that would assign the address of the third element of stuff to pointer q

Çözüm

4.4257 Voting
avatar
Osman
Elit · 8 yıl öğretmeni
Uzman doğrulaması

Cevap

a) To access the 5th element of the array using the pointer variable `p`, you can use the following statement:<br />```<br />p + 4<br />```<br />b) To assign the address of the third element of `stuff` to the pointer `q`, you can use the following statement:<br />```<br />q = &stuff[2];<br />```
Derecelendirmek için tıklayın: