How we can get reference address of array

#include <iostream>
using namespace std;

void main ()
{
       int *p ;
       int name[] = {1,2,3,4,5};

       cout<<"Value"<<"\t"<<"Address"<<endl;
       cout<<"-------------------"<<endl;
      
       for (int i=0; i<=4;i++)
       {
              p=&name[i];
              cout<<*p<<"\t"<<p<<endl;
       }

       cout<<"\n...The reversed order...\n"<<endl;
       cout<<"Value"<<"\t"<<"Address"<<endl;
       cout<<"-------------------"<<endl;

       for (int i=4; i>=0;i--)
       {
              p=&name[i];
              cout<<*p<<"\t"<<p<<endl;
              }

       cout<<"\n\n\n\n\n";
}

Comments

Popular posts from this blog

Umbrella activities in Software Engineering

Operating System | Best Definition of Opetating System