const int MINNUMBER = -32767; int find_sec_max(int data[], int count){ int maxnumber = data[0]; int sec_max = MINNUMBER; for (int i = 1; i < count; ++i) { if(data[i] > maxnumber){ sec_max = maxnumber; maxnumber = data[i]; } else{ if(data[i] > sec_max) sec_max = data[i]; } } return sec_max; }