Question: Assume the following declarations. int num [ 1 0 0 ] ; int * p 1 ; int * p 2 ; ( a )

Assume the following declarations.
int num[100];
int* p1;
int* p2;
(a) Write a statement that will make p1 point to the first element of the array num[].
(b) Write a statement that will make p2 point to the last element of the array num[].
(c) After these two statements are executed, what will be the value of p2- p1 using
pointer arithmetic?
(d) Assuming that you are dealing with a system such that each integer requires 32 bits
(4 bytes), what will be the actual difference between the memory addresses stored in
p1 and p2?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!