title: 2 Dimensional Arrays.Why do I have to declare size of Columns in C
body: <p>I want to ask a question about 2D arrays in C .First Let me explain what I want to do.</p>
  
  <p>I am trying to read names into a 2D array till user enters 0 and from that array I want to randomly pick an name. Now I have couple of questions.</p>
  
  <p>Why do I have to declare the size of <code>arr</code>? I want to do it like <code>char arr[][50]</code> the reason that am asking this is because I took a semester of C before my current semester and I remember my tutor said something like you don't have to declare size of column as long as you declare a row size.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  void main(){
      char arr[50][50];
      int i;
      for(i= 0 ; i &lt; 50; i++){
          scanf("%s",&amp;arr[i]);  
      }
  }
  </code></pre>
  
  <p>I just found that I was missing braces after if inside for code gives no error at the moment but entering 0 from the keyboard does not executes the proccess.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  void main(){
      char arr[0][50];
      int i;
      for(i= 0 ; i &lt; 50; i++){
          scanf("%49s", arr[i]);
          if(arr[i]== 0){
              arr[i][0] = '\0';
              break;}
  
      }
  }
  </code></pre>
  
  <p>Also I want to read names in a function but couldn't figure out how to pass the <code>arr[50][50]</code> to a function So I can read names in that function.</p>
  
  <p>I am trying to work with ANSI C</p>