Question: C++ pointers Part I 1. Define int variables x and y and int* pointer variables p and q. Assign x the value 2, y the
C++ pointers Part I
1. Define int variables x and y and int* pointer variables p and q.
Assign x the value 2, y the value 8, set p to contain the address of x, and q to contain the address of y. Then output the following information, using appropriate messages: a. The address of x and the value of x. b. The value of p and the value of *p. c. The address of y and the value of y. d. The value of q and the value of *q. e. The address of p (not its contents!). f. The address of q (not its contents!).
Part II
2. For the following, use the pointer notation ONLY. Do NOT use the array index [] notation. Define the variables below and write code which prints the characters in a c string in a reverse order. char s[10] = "abcde"; char* cptr;
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
