Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Next »

🎯 Objective

In essence, a pointer is a variable that stores the memory address of another variable. Using pointers allows you to directly manipulate the memory locations of variables, allowing you to manage memory and build complex data structures efficiently.

In this lab, you will practice the fundamentals of pointers, including how to declare and initialize pointers, access the memory address of a variable, and use pointers to manipulate data.

\uD83D\uDDD2 Requirements

Create your main program and code the steps in the following pseudo-code

    // declare an integer variable myNumber and assign a value of 5
    // declare a pointer variable myPointer of type integer
    
    // assign the memory address of myNumber to the pointer variable myPointer
    
    // print the value of myNumber
    // print the memory address of myNumber
    // print the value of the pointer variable myPointer
    // print the value pointed to by myPointer (which is the value of myNumber)
    // add 10 to the value pointed to by myPointer
    // print the value pointed to by myPointer (which is the value of myNumber)    
 

🚚 Deliverable

Upload the following:

  1. Full source code (.cpp files or .txt files)

  2. Screenshot of the Console with the code executing

  • No labels