Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ help with pointers please!!! I'm doing a bit of practice and I want some help in understanding on what every line of code does

C++ help with pointers please!!!

I'm doing a bit of practice and I want some help in understanding on what every line of code does and what some line of code can't work. Give me a thorough understanding on what's what and how some variables interact with each other depending on the pointers or double pointers. Thank you!!!

Practice code:

int var = 789; cout << var; cout << endl;

//pointer for var int *ptr2; //cout << ptr2 << endl; // cout << *ptr2 << endl; cout << &ptr2 << endl; cout << endl;

//double pointer for ptr2 int **ptr1; //cout << ptr1 << endl; //cout << *ptr1 << endl; cout << &ptr1 << endl;

//storing address of var in ptr2 ptr2 = &var; cout << var << endl; cout << &var << endl; //cout << *var << endl; cout << endl;

//storing address of ptr2 in ptr1 ptr1 = &ptr2; cout << ptr1 << endl; cout << *ptr1 << endl; cout << &ptr1 << endl; cout << ptr2 << endl; cout << *ptr2 << endl; cout << &ptr2 << endl; cout << endl; system("pause");

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

=+How does memory for information fade with the passage of time?

Answered: 1 week ago

Question

8. Explain the difference between translation and interpretation.

Answered: 1 week ago

Question

10. Discuss the complexities of language policies.

Answered: 1 week ago

Question

1. Understand how verbal and nonverbal communication differ.

Answered: 1 week ago