#include <stdio.h> void select(int* data,int data_size,int &Max,int &secondMax){ //Max=data[0]; //secondMax=data[0]; for(int i=0;i<data_size;i++){ if(Max<data[i]){ secondMax=Max; Max=data[i]; }else{ secondMax=data[i]; } } } int main(int argc,char* argv[]){ int testData[]={2,5,1,8,4,3,7,9,6}; int Max=testData[0]; int secondMax=testData[0]; select(testData,sizeof(testData)/sizeof(int),Max,secondMax); printf("the Max Num:%d\n",Max); printf("the second Max Num:%d\n",secondMax); return 0; }