标签:desktop include number mamicode lib image cti use fopen
// practice #include<stdio.h> //#include<conio.h> #include<stdlib.h> double func1(int (*number)[4]) { int k=0; double result =0; for(int i=0;i<3;i++) { for(int j=0;j<4;j++) { if(i==0||i==2||j==0||j==3) { result += number[i][j]; k++; } } } return result/k; } int main() { //FILE * f; int number [3][4]= {1,2,4,5,6,7,8,9,11,22,33,44}; // system("CLS"); printf("*******the array is *******\n"); for(int i=0;i<3;i++) { for(int j=0;j<4;j++) { printf("%4d",number[i][j]); } printf("\n"); } double result = func1(number); printf("the result is %.2f",result); // f = fopen("C:\\user\\mike1\\desktop\\result.txt","w"); //fprintf(f,"%f",result); //fclose(f); return 0; } //conclusion : int a[][3] 可以fun(int[][3]) 也可以fun(int (*a)[4]) // a 的实际类型为 int[][3] 既不是 int* 也不是int(*)
标签:desktop include number mamicode lib image cti use fopen
原文地址:https://www.cnblogs.com/zijidefengge/p/12641106.html