Skip to main content

Pointer in c++

Address in C++

To understand pointers, you should first know how data is stored on the computer.
Each variable you create in your program is assigned a location in the computer's memory. The value the variable stores is actually stored in the location assigned.
To know where the data is stored, C++ has an & operator. The & (reference) operator gives you the address occupied by a variable.
If var is a variable then, &var gives the address of that variable.

Example 1: Address in C++

  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5. int var1 = 3;
  6. int var2 = 24
  7. int var3 = 17;
  8. cout << &var1 << endl;
  9. cout << &var2 << endl;
  10. cout << &var3 << endl;
  11. }
0x7fff5fbff8a4C++ Inheritance


  1. Your content is excellent but I think the codeexampler website multilevel inheritance is also the best multilevel inheritance in c# with example

  2. amazing content oops concepts and if you want to cher mern pg website so check on pg in noida pgwars website


Post a Comment

Thanks for your message