google search

Popular Posts


Welcome to BCA Notes

>>>>>>>>>>>>>>>>

Visitors

Search This Blog

Blogger templates

Visitor Map


Thursday 20 March 2014

Passing Pointer to an Array

#include<iostream.h>
main()
{
int a[5];
int *pt;
pt=a;
for(int p=0;p<5;p++)
{
cout <<"Enter Value to be insterted in "<<p<<" Index:";
cin>>*pt;
a[p]=*pt;

}
cout<<"Value at O Index:"<<a[0]<<"\n";
cout<<"Value at 1 Index:"<<a[1]<<"\n";
cout<<"Value at 2 Index:"<<a[2]<<"\n";
cout<<"Value at 3 Index:"<<a[3]<<"\n";
cout<<"Value at 4 Index:"<<a[4]<<"\n";
//cout<<"Value at O Index:"<<a[5]<<"\n";
}

0 comments:

Post a Comment