title: How to use scanf function for an array
body: <p>I want to find the date,month and year through a given set of numbers using the array and pointers.I am writing the program to learn C.</p>
  
  <p>Below is the output:</p>
  
  <p>Enter the number : 22102013
  Today is the day is 22,month is 10 and the year is 2013.</p>
  
  <p>And i have wrote the following code.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  int main()
  {
      char date [11];
  
      char days []="DD";
      char month[]="MM";
      char year []="YYYY";
  
      printf("Enter the year that you want \n");
      scanf ("%d",&amp;date[11]);
  
  
      char *my_pointer = date;
      days[0] = *(my_pointer);
      days[1] = *(my_pointer+1);
  
  
      month[0]=*(my_pointer+2);
      month[1]=*(my_pointer+3);
  
      year [0]=*(my_pointer+4);
      year [1]=*(my_pointer+5);
      year [2]=*(my_pointer+6);
      year [3]=*(my_pointer+7);
  
  printf("Today the day is %s,the month is %s and the year is %s",days,month,year);
      return 0;
  }
  </code></pre>
  
  <p>Also i had not initialized the array size but it kept raising error for declaration of the array.</p>