#include "stdio.h"
#include "stdlib.h"
void func( int a );
int main( int argc, char* argv )
;printf("the value of array name y:%d/n", *y);
printf("the value of array name y:%d/n", *(y+1));
printf("the value of array name y:%d/n", *(y+2));
printf("the value of array name y:%d/n", *(y+3));
int * q = y;
printf("the value of point q:%d/n",*q);
printf("the value of point q+1:%d/n",*(++q));
printf("the value of point q+2:%d/n",*(++q));
printf("the value of point q+3:%d/n",*(++q));
/* 2d array -> 1d pointer */
int z[3][2] = ,,};
int * r = null;
r = (int *)&z;
printf("the value of point r:%d/n",*r);
printf("the value of point r+1:%d/n",*(r+1));
printf("the value of point r+2:%d/n",*(r+2));
printf("the value of point r+3:%d/n",*(r+3));
r++;
printf("the value of point r:%d/n",*r);
printf("the value of point r+1:%d/n",*(r+1));
printf("the value of point r+2:%d/n",*(r+2));
printf("the value of point r+3:%d/n",*(r+3));
int *s = z[0];
printf("the value of point s:%d/n",*r);
printf("the value of point s+1:%d/n",*(r+1));
printf("the value of point s+2:%d/n",*(r+2));
printf("the value of point s+3:%d/n",*(r+3));
/* 2d array -> pointer of array. */ //in this segment, [x][y] is changed to pointer address plus (x-1)*y + y
int (*t)[2] = (int (*)[2])z;
printf("t's content: %d/n", t[0][0]);
printf("t's content: %d/n", t[0][1]);
printf("t's content: %d/n", t[1][0]);
printf("t's content: %d/n", t[1][1]);
printf("t's content: %d/n", t[0][2]);
printf("t's content: %d/n", t[0][3]);
printf("t's content: %d/n", t[0][4]);
int (*tt)[6] = (int (*)[6])z;
printf("tt's content: %d/n", tt[0][0]);
printf("tt's content: %d/n", tt[0][1]);
printf("tt's content: %d/n", tt[0][2]);
printf("tt's content: %d/n", tt[0][3]);
printf("tt's content: %d/n", tt[0][4]);
/* 1d -> pointer of array. */
int a[3] = ;
//int *po = a;
int (*poo)[3] = (int (*)[3])&a;
printf("poo's content: %d/n", poo[0][0]);
printf("poo's content: %d/n", poo[0][1]);
printf("poo's content: %d/n", poo[0][2]);
int b[3] = ;
func(b);
printf("end/n");
}void func( int a )
關於C語言的指標陣列與指標陣列的個人理解
一 指標陣列與指標陣列 1,指標陣列 顧名思義,即乙個元素全部是指標的陣列,其形式與普通陣列相似,形式如 a n 在理解指標陣列的使用方式前,我先來說下我個人對陣列的理解。比如一維整形陣列 形如int a 3 其實是乙個具有3個整形元素的變數 二維整形陣列 形如int a 4 3 可將其視為有a 4...
C語言 陣列指標和陣列指標的理解
陣列指標和指標陣列如何分辨呢看他後面的側重 例如 分解 int a 3 int 3 a 指標陣列 int b 3 int 3 b 陣列指標 片段 這段 定義了乙個陣列指標和乙個陣列指標,利用指標的偏移來做測試 include int b 3 陣列指標 char str1 good char str2...
C 指標與陣列的理解
參考文章 雖然部分內容有錯誤,但是整體講的不錯 int a 3 輸出如下 陣列a的元素型別為int,因此相鄰兩個元素的位址相差4個位元組。每個元素的位址由16個十六進製制數表示,每個十六進製制數可由4個二進位制數表示,8個二進位制數占用乙個位元組的記憶體空間。因此元素的位址 即指標變數 占用8個位元...