#include<stdio.h>
typedef struct time{
int hour;
int minute;
int second;
};
void timeUpdate(struct time*p){
if(p->second!=59)
p->second++;
else if(p->minute!=59){
p->minute++;
p->second=0;
}else if(p->hour!=23){
p->second=0;
p->minute=0;
p->hour++;
}else{
p->second=0;
p->minute=0;
p->hour=0;
}
}
int main(void){
struct time testTimes[5] = {
{11, 59, 59}, {12, 0, 0}, {1, 29, 59}, {23, 59, 59}, {19, 12, 27}
};
int i = 0;
for (i = 0; i < 5; i++) {
printf("Now the time is:%d - %d - %d\n",
testTimes[i].hour, testTimes[i].minute, testTimes[i].second);
//testTimes[i] = *timeUpdate(&testTimes[i]);
timeUpdate (&testTimes[i]);
printf("one second letter:%d - %d - %d\n",
testTimes[i].hour, testTimes[i].minute, testTimes[i].second);
}
return 0;
}