1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
|
1.
int array[]={7,4,12,3,5};
for(int i=0;i<5;i++)
cout<<*(array+i)<<endl;
2.
int array[]={7,4,12,3,5};
int *pointer = array;
for(int i=0;i<5;i++)
cout<<*(pointer+i)<<endl;
3.
int array[]={7,4,12,3,5};
int *pointer = array;
for(int i=0;i<5;i++,pointer++)
cout<<*pointer<<endl;
4.
int array[]={7,4,12,3,5};
for(int i=0;i<5;i++,array++)
cout<<*array<<endl;
|