Pointers...Problem still exists
Hi everyone, I need help with the pointers. Here's my question:
Using a pointer, write a function named time() that accepts an integer number of seconds and the addresses of three variables named hours, min, nad sec. The function is to convert the passed number of seconds into an equivalent number of hours, minutes, and seconds and directly alter the vlaue of respective variables using the passed addresses.
To test, run the program using 10,000 seconds.
This is what I have done so far, but its not working...
int time(int time, int *hours, int *mins, int *secs);
int time, secs, mins, hours;
printf("Enter the number of time in seconds: ");
printf("\nHours: ", &hours);
printf("\nMinutes: ", &mins);
printf("\nSeconds: ", &secs);
int time (int time, int *hours, int *mins, int *secs)
*hours = time / 3600;
time %= 3600;
*mins = time / 60;
time %= 60;
*secs = time;