{
int iTemp;
for(int i=0;i<Count-1;i++) {
for(int j=i+1;j<Count;j++) {
if(pData[j]<pData[i]) {
iTemp = pData[i];
pData[i] = pData[j];
pData[j] = iTemp;
}
}
}
}
int validMonth(int mon, char* errmes){ int res = 0; if(mon > 0 && mon <=12){ res = 1; } else{ strcpy(errmes, "Invalid month (1<=month<=12)"); } return res; }write the above function in one line:
int validMonth(int mon, char* errmes){
return (mon>0&&mon<=12)||(strcpy(errmes, "Invalid month (1<=month<=12)")&& 0);
}