Answer to Question #349380 in C++ for vince

Question #349380

Instructions:

  1. In the code editor, you are provided with an initial code where a constant variable is declared.
  2. Your only task is to assign the address of this variable to the first pointer found at line 10.

Output


My·destiny·=·11



#include <iostream>

using namespace std;


int main(void) {

  int destiny = 22;


  int *ptr1, *ptr2, *ptr3;


  // TODOFill in the blank

  ptr1 = ;

  ptr2 = ptr1;

  ptr3 = ptr2;


  cout << "My destiny = " << *ptr3;


  return 0;

}





1
Expert's answer
2022-06-10T18:34:31-0400
#include <iostream>

using namespace std;


int main(void) {

    int destiny = 22;


    int* ptr1, * ptr2, * ptr3;


    // TODOFill in the blank

    ptr1 = &destiny;

    ptr2 = ptr1;

    ptr3 = ptr2;


    cout << "My destiny = " << *ptr3;


    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
APPROVED BY CLIENTS