c 陣列使用

2021-10-24 10:37:02 字數 987 閱讀 3043

很基礎的東西,做個筆記;

#includeusing namespace std;

void main()

; //我們可以先去列印a[0] 與 a[9]之間的記憶體差看看效果

cout << &a[0] << " " << &a[1] << " " << &a[9] << endl; //& 在這裡是取位址符

printf("陣列方式輸出:\n");

for (int i = 0; i < len; i++)

printf("\n\n指標當成陣列來使用:\n");

for (int i = 0; i < len; i++)

printf("\n\n以指標的方式訪問:\n");

int *temp_ptr = p_array;

for (int i = 0; i < len; i++)

getchar();

}

C 陣列 使用速查

1 一維陣列 值型別 int myintegers 申明乙個陣列的引用 myintegers new int 100 建立乙個含有100個int元素的資料 2 一維陣列 引用型別 control mycontrols 宣告乙個陣列引用 mycontrols new control 3 建立乙個含有3...

C 陣列的使用

一 array 直接初始化 char 陣列是特殊的,這種初始化要記得字元是以乙個 null 結尾的。chara1 初始化,沒有 null chara2 初始化,明確有 null chara3 c null 終止符自動新增 const chara4 6 aaronc 報錯,沒有 null 的位置a4 ...

C語言 使用陣列

main.c 例 created by weichen on 15 1 9.include intmain if count 0 return0 main.c 例 created by weichen on 15 1 14.include intmain if n 0 return0 注 xcode...