Question
Pointers Worksheet (C++) Name: ________________________________________________ Create an integer variable called val Create a pointer called p Create a pointer called q Name Value Mem Address
Pointers Worksheet (C++)
Name: ________________________________________________
Create an integer variable called val
Create a pointer called p
Create a pointer called q
Name |
|
|
|
|
|
|
|
|
|
Value |
|
|
|
|
|
|
|
|
|
Mem Address | 100 | 104 | 108 | 112 | 116 | 120 | 124 | 128 | 132 |
Assign 4 to val
Make p point to val
Make q point to what p points to
Name |
|
|
|
|
|
|
|
|
|
Value |
|
|
|
|
|
|
|
|
|
Mem Address | 100 | 104 | 108 | 112 | 116 | 120 | 124 | 128 | 132 |
Write code to make val display its address
Write code to make p display the value of the variable it points to
Use p to change the value of val to 10
Name |
|
|
|
|
|
|
|
|
|
Value |
|
|
|
|
|
|
|
|
|
Mem Address | 100 | 104 | 108 | 112 | 116 | 120 | 124 | 128 | 132 |
Make q point to nothing
Which of the following statements are syntactically correct?
- val = p;
- q = &val;
- *p = val;
- *p = *q;
- *p = &val
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started