i been trying trying to convert a number of seconds into days, hours, min and seconds. but i keep getting errors, "expected identifier or '('" . how should i fix it.`

#include <stdio.h>
#include <stdlib.h>

void to_dhms(int total_s, int *d, int *h, int *min, int *s);


int main(void)
{
  int seconds_in, days, hours, minutes, seconds, scan_count;

  printf("Enter a number of seconds that is >= 0: ");
  scan_count = scanf("%d", &seconds_in);  
  if (scan_count != 1) 
  {
    printf("Unable to convert your input to an int.\n");
    exit(1);
  }
  if (seconds_in < 0) 
  {
    printf("%d s is out of range!\n", seconds_in);
    exit(1);
  } 

  printf("Doing conversion for input of %d s ... \n", seconds_in);



  result= to_dhms(days, hours, minutes, seconds);
    printf("That is %d day(s), %d hours(s), %d minute(s), %d second(s).\n",
         days, hours, minutes, seconds);

  return 0;


}
void to_dhms(int total_s, int *d, int *h, int *min, int *s);
{
  *d = total_s / 86400;
  remaining= total_s% 86400;
  *h= remaining/ 3600;
  remaningofh= remaining%3600;
  *min= remaningofh/ 60;
  *s =remaningofh % 60;
  return result;

}

`

2 issues.

  1. The function to_dhms is typed as void yet you try something in line 44.
  2. The value result in line 44 appears to be undeclared. Where is this declared?

Remember that the assignment is as follows so no one can fix this for you without doing your homework. Again:
" That is the entire exercise that I see at https://www.chegg.com/homework-help/questions-and-answers/practice-problem-c-programming-answer-better-explanations-thanks-file-lab2excc-include-inc-q31245952 "

I think you need to review not only the tutorial I linked about called a function but review a tutorial about variables in c.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.