title: how to store time in an array
body: <p>I am still new to c. I am trying to log the time and date into an array</p>
  
  <pre><code>#define _CRT_SECURE_NO_WARNINGS
  #include &lt;stdio.h&gt;
  #include &lt;time.h&gt;
  
  int main(void) {
  char prompt, start = 0;
  char arr[20];
  struct tm *sTm;
  time_t now = time(0);
  sTm = gmtime(&amp;now);
  
  strftime(arr, sizeof(arr), "%Y-%m-%d %H:%M:%S", sTm);
  printf("%s %s\n", arr, "Event occurred now");
  printf("Time is %d:%d:%d Date is %d-%d-%d \n", sTm-&gt;tm_hour, sTm-&gt;tm_min, sTm-&gt;tm_sec, sTm-&gt;tm_mday, sTm-&gt;tm_mon+1,sTm-&gt;tm_year+1900);
  printf("Press and key to exit \n\r");
  scanf("\n%c", &amp;prompt);
  
  return 0;
  }
  </code></pre>
  
  <p>in short I want the values of this line</p>
  
  <pre><code>printf("Time is %d:%d:%d Date is %d-%d-%d \n", sTm-&gt;tm_hour, sTm-&gt;tm_min, sTm-&gt;tm_sec, sTm-&gt;tm_mday, sTm-&gt;tm_mon+1,sTm-&gt;tm_year+1900);
  </code></pre>
  
  <p>in an array such as Timeanddate[1] = 14:53:04,20/3/2016</p>