數組是一種由相同數據類型組成的構造類型
定義:類型說明符 數組名[常量表達式]? = {值1,值2...};
array:中文數組的意思
temp:臨時存放
count:累加
隨機數式子:
冒泡排序:
//? ? int numbers[] = {6,8,3,4,9,1};
//? ? BOOL flag = YES;
//? ? for (int j = 0; j < 6 -1 && flag == YES ; j++) {
//? ? ? ? flag = NO;
//? ? ? ? for (int i = 0; i < 6 - 1 - j; i++) {
//? ? ? ? ? ? if (numbers[i] > numbers[i + 1]) {
//? ? ? ? ? ? ? ? int temp = numbers[i + 1];
//? ? ? ? ? ? ? ? numbers[i + 1] = numbers[i];
//? ? ? ? ? ? ? ? numbers[i] = temp;
//? ? ? ? ? ? ? ? flag = YES;
//? ? ? ? ? ? }
//? ? ? ? }
//? ? }
//? ? for (int? i = 0; i < 6; i++) {
//? ? ? ? printf("%d\n",numbers[i]);
//? ? }
sizeof()? :查看所占空間的大小
字符數組:有'\n'結束標志的字符數組也稱為字符串
字符串處理函數:
strlen() :計算字符串長度
strcpy():字符串拷貝
strcat(): 字符串拼接
strcmp():字符串比較
unsigned long : 無符號長整形
宏定義: # define pi 3.14
# define mul (A,B) ((A)*(B))