title: How to print array with looping with C
body: <p>I want to make programs that request integer input from the user. if the user enters 0, it will display &quot;Sunday&quot;, if the user enters 1, the program will display &quot;Monday&quot; and so on until &quot;Saturday&quot;. If the user enters a value outside the range 0 to 6, the program writes &quot;Invalid Days&quot;. but when I input a integer the array of days didnt show up. What should I do ?</p>
  <p>This is &quot;code.cpp&quot;</p>
  <pre><code>main(){
      char days[7] = {&quot;Sunday&quot;,&quot;Monday&quot;,&quot;Tuesdat&quot;,&quot;Wednesday&quot;,&quot;Thursday&quot;,&quot;Friday&quot;,&quot;Saturday&quot;};
      
      int i;
      
      printf(&quot;Input Integer:&quot;);
      scanf(&quot;%d&quot;,&amp;i);
      
      if(i &lt; 0 || i &gt;= 7) {
        printf(&quot;invalid days\n&quot;);
        return;
      }    
  
      for (i ; i &lt; 7;i++)
      {
          printf(&quot;Days: %d\n&quot;, days[i]);
      }
  }
  </code></pre>
  <p>When i run it at dev C++ it show error,</p>
  <blockquote>
  <p>4 91  F:\IPB\PENUGASAN\MATKUL\MATERI - Copy\APLIKOM\C++\UAS\UAS 2.cpp [Error] too many initializers for 'char [7]'</p>
  <p>13    7   F:\IPB\PENUGASAN\MATKUL\MATERI - Copy\APLIKOM\C++\UAS\UAS 2.cpp [Error] return-statement with no value, in function returning 'int' [-fpermissive]</p>
  </blockquote>