#include<stdio.h> int main() { int buf[3][5] ={{1,2,3,4,5},{4,5,6,7,8},{7,8,9,10,11}}; int i; int j; //求行平均值 for(i = 0; i < 3; i++) { int sum = 0; for(j = 0; j < 5; j++) { sum += (*(*(buf + i) + j)); } printf("sum = %d ",sum/5); } //求列平均值 for(i = 0; i < 5; i++) { int sum = 0; for(j = 0; j < 3; j++) { sum += (*(*(buf + j) + i)); } printf("sum = %d ",sum/3); } return 0; }