title: How to modify a struct in a function and return to main?
body: <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  
  struct time{int hours, mins, secs;};
  
  int main(int argc, char *argv[])
  {
  struct time one;
  struct time two; 
  
  printf("\nplease enter the time in 24 hr format, \nenter the hours, return,\nenter minutes, return, enter seconds, and return.\n");
  
  scanf("%d\n%d\n%d", &amp;one.hours, &amp;one.mins, &amp;one.secs); 
  int yn; 
  
  yn = validateTime(one, yn); 
  while(!yn){ 
  
  
        if (!yn){
           puts("Invalid input\nPlease try again"); 
           printf("\nplease enter the time in 24 hr format, \nenter the hours, return,\nenter minutes, return, enter seconds, and return.\n");
           scanf("%d\n%d\n%d", &amp;one.hours, &amp;one.mins, &amp;one.secs);  
           yn = validateTime(one);
        }
        else{ 
           printf ("Time entered was; %d:%d:%d", one.hours, one.mins, one.secs);  
        }
        }
           printf ("the time entered ws; %d:%d:%d", one.hours, one.mins, one.secs);
  char input[4]; 
  puts("would you like to update the time"); 
  scanf("%s", input); 
  if(strcmp(input,"yes")== 0){ 
        puts("please enter update for time"); 
        scanf("%d\n%d\n%d", &amp;two.hours, &amp;two.mins, &amp;two.secs); 
        if (two.hours &gt; 0|| two.mins &gt; 0 || two.secs &gt; 0){
            struct time updateTime(one, two);   
        printf ("%d", one.hours);
        }
        }
    getch();
    return 0;  
  } 
  
  
  int validateTime(struct time tme, int yn)
  {
  
  if (tme.hours &lt; 0 || tme.hours &gt; 23 || tme.mins &gt; 59 || tme.mins &lt; 0 || tme.secs &lt; 0 || tme.secs &gt; 59)
  {
                printf("retfal4");
       yn = 0;
       return yn;
       }
  else {
       printf("rettru");
       yn = 1;
       return yn; 
  
       }
  }
  struct time updateTime(struct time one, struct time two){
         puts("flag1");
  
          struct one;
          struct two;  
  
                   puts("flag");
                  one.hours = one.hours + two.hours;
  
                  one.mins = one.mins + two.mins; 
  
  
                 one.secs = one.secs + two.secs; 
  
                    while (two.hours &gt; 23) {
                      one.hours = one.hours - 24;}
  
                      while (two.mins &gt; 59){
                      one.mins = one.mins - 60;
                      one.hours ++;}
  
                      while (two.secs &gt; 59){
                      one.secs = one.secs - 60;
                      one.mins ++;}  
  
                  return one; 
  
                  }  
  </code></pre>
  
  <p>program takes in a struct of time, validates it as a 24hr time and prompts user for an update takes an update in HH:MM:SS i.e. if the time was 23:45:00 and update time entered was 01:30:00 then the original time would become 01:15:00. </p>
  
  <p>I want to modify struct one in function updateTime, doesn't seem to be going through the function in the first place. how can I get this to work? currently it will run through the full program without errors BUT it will not change the time and pass it back to the main function, currently just testing with hours. </p>