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 yada yada; }
answer:
return((mon>0 && mon <=12) || !strcpy(errmes, "Invalid month!"));
No comments:
Post a Comment