引用&

// 引用.cpp : Defines the entry point for the console application.
//

#include "StdAfx.h"
#include "iostream.h"

int main(int argc, char* argv[])
{
// printf("Hello World!\n");
 int a[3] ={1,2,0};
// a[0]=0;a[1]=1;a[2]=2;
 int *p,*q;
 p = a;
 q = &a[2];
 cout<<a[q-p]<<endl;
 return 0;
}

 //不論a[2]值如何改變,結果都爲a[2];值爲0;

// printf("Hello World!\n");
 int a[6] ={1,2,10,4,5,6};
// a[0]=0;a[1]=1;a[2]=2;
 int *p,*q;
 p = a;
 q = &a[2];
 cout<<a[q-p]<<endl;
 return 0;
}

//值爲10;

P =A ;和A[Q-P]  這兒還有點疑問。

 ////////////////////////////////

 int a[] = {1,2,3,4,5};
/* int i;
 for (i=0;i<=4;i++)
 {
  cout<<a<<endl;
 }
 */
 int *i ;
 i = a;
 for (int b=0;b<=4;b++)
 {
 
 cout<<*i<<endl;
 }
 return 0;
 }

輸出值爲1 1 1 1 1

//////////////////////////////////

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章