Dereference pointers

Given the declaration:

int num1, num2;

int *p1;

int *p2;

double *p3;

Mark the following statements as valid or invalid. If a statement is invalid, explain why. (2, 3)

a. p1 = &num1;

b. num2 = num1 – *p2;

c. p3 = p2;

d. *p3 = num1; e. *p3 = *p1;

f. num1 5 p2;

g. p1 = &p2;

h. p3 = &num1;

i. num1 = *p3;

j. num2 = &p1;

a. How is * used to create pointers? Give an example to justify your answer. (2)

b. How is * used to dereference pointers? Give an example to justify your answer. (2)

WhatsApp
Hello! Need help with your assignments?

For faster services, inquiry about  new assignments submission or  follow ups on your assignments please text us/call us on +1 (251) 265-5102

🛡️ Worried About Plagiarism? Run a Free Turnitin Check Today!
Get peace of mind with a 100% AI-Free Report and expert editing assistance.

X