Answer to Question #318139 in C++ for markann

Question #318139

Code a C++ program that will display the value of a given variable, and reference to another address, then, the value point-to another address. Given the value of variable is equal to 750.


1
Expert's answer
2022-03-27T09:59:40-0400
#include <iostream>
using namespace std;


int main() {
    int variable = 750;
    int another = 0;
    int *pointer = &variable;


    cout << "Value of variable = " << variable << endl;
    cout << "The value by pointer =  " << *pointer << endl;
    pointer--;
    cout << "The value pointed-to another address = " << *pointer << endl;


    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog