1.
1 #include <stdio.h> 2 3 void main(){ 4 char word[26]; 5 for (int i = 0; i < 26; i++){ 6 word[i]='A'+i; 7 } 8 9 for (int i = 0; i < 26; i++){ 10 printf("word[%d]=%c;", i, word[i]); 11 } 12 13 }
2.
1 #include <stdio.h> 2 3 void main(){ 4 int arr[] = {0,1,-2,89,400}; 5 int arrLen = sizeof(arr) / sizeof(int); 6 int max = arr[0]; 7 int j = 0; 8 for (int i = 1; i < arrLen; i++){ 9 if (arr[i]>max){ 10 max = arr[i]; 11 j = i; 12 } 13 } 14 printf("max=%d,下标为:%d", max, j); 15 }
标签:arr,word,数组,int,max,++,26,案例,应用 From: https://www.cnblogs.com/MorningMaple/p/16768813.html