Given the following declaration int num int ptr1 int ptr2 do

Given the following declaration: int num; int *ptr1; int *ptr2; double *ptr3; Mark the following statements as valid or Invalid. If a statement Is Invalid, explain why. (1 point per problem) Ptr1 = ptr2; num = ptr1; ptr3 = ptr1;*prt3 = *ptr2; *ptr1 =*ptr2; num = *ptr2; ptr1 = &ptr2; ptr1 = # num = &ptr1;

Solution

int num;
int *ptr1; int *ptr2;
double *ptr3;

a) valid
b) invalid. An int data type cannot hold the value of an int pointer.
c) invalid. An double pointer cannot hold the value of an int pointer.
d) valid.
e) valid.
f) valid.
g) invalid. An int pointer cannot hold the value of an int double pointer.
h) valid.
i) invaild. An int data type cannot hold the value of an int double pointer.

 Given the following declaration: int num; int *ptr1; int *ptr2; double *ptr3; Mark the following statements as valid or Invalid. If a statement Is Invalid, exp

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site