Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

pointers in c++

#include <iostream>

using namespace std;

int main()
{
   int x=5;
   int *ptr=&x;
   cout<<&x<<endl;        //prints the address of the variable (x)
   cout<<ptr<<endl;       //prints the address of the variable (x)
   cout<<*ptr<<endl;      //prints the value of x(5)
   cout<<&ptr<<endl;      //prints the address of the pointer (ptr)
   
   
}
 
PREVIOUS NEXT
Tagged: #pointers
ADD COMMENT
Topic
Name
6+2 =