#include <iostream>
#include <conio>
void main()
{
int arr[44],*ptr,i;
cout<<"Enter element into Array\n";
for(i=0;i<5;i++)
{
cin>>arr[i];
}
ptr=&arr[0];
for(i=0;i<5;i++)
{
cout<<"arr["<<i<<"]"<<"=\t"<<arr[i]<<endl;
}
cout<<"For pointer\n";
for(i=0;i<5;i++)
{
cout<<"arr["<<i<<"]"<<"=\t"<<*(ptr+i)<<endl;
}
getch();
}
#include <conio>
void main()
{
int arr[44],*ptr,i;
cout<<"Enter element into Array\n";
for(i=0;i<5;i++)
{
cin>>arr[i];
}
ptr=&arr[0];
for(i=0;i<5;i++)
{
cout<<"arr["<<i<<"]"<<"=\t"<<arr[i]<<endl;
}
cout<<"For pointer\n";
for(i=0;i<5;i++)
{
cout<<"arr["<<i<<"]"<<"=\t"<<*(ptr+i)<<endl;
}
getch();
}
0 comments:
Post a Comment