i am trying to Convert a number of seconds into days, hours, minutes, and seconds. using pointers but something seems wrong . can somone tell me what is the problem and how to solve it. it keeps telling me
error: function definition is not allowed here

#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);

  int main(void)
  {
    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);
{
  days = seconds_in / 86400;
  seconds = seconds_in % 86400;
  hours=seconds_in / 3600;
  hours= hours %3600;
  minutes= seconds_in / 60;
  minutes= seconds_in %60;
  seconds = seconds_in% 60;

}

My advice is to correct your code and post it again.

PS. Your last comment is a bit mangled but about line 26, I can't guess why you wrote that there. You should tell me and then we can discuss.

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.