Program to enter n number of elements using concept of pointer to array as well as incremental operator

#include
#include
main()
{
int *a,*b,i,n;
b=a;
clrscr();
cout<>n;
cout<<"n Enter the elements:n";
for(i=0;i<n;i++)
{
cout<<"n A["<<i<>*a;
a++;
}
cout<<"nnn";
cout<<"n Entered element of array were:";
a=b;
for(i=0;i<n;i++)
{
cout<<"n Address location"<<a<<"contains value A["<<i<<"]="<<*a;
a++;
}
getch();
}

Leave a reply