title: How to use array of pointers?
body: <p>I wrote a C program to create an array of pointers and each of the individual pointers will in turn be separate arrays(somewhat like a 2D array). I wrote the following C code but it doesn't work.  </p>
  
  <pre><code>#include&lt;stdlib.h&gt;
  #include&lt;conio.h&gt;
  int main(void)
  {
      int rows=5,cols = 5;
      int *a[100];
      int i = 0;
      int j;
      int k = 0;
      int b[100];
      while(i&lt;rows)
      {
          printf("\nEnter the %d row: ",i);
          for(j=0;j&lt;cols;j++)
              scanf("%d",&amp;b[j]);
  
          a[k++] = b;
          i = i + 1;
      }
      k = k-1;
      for(i=0;i&lt;=k;i++){
          for(j=0;j&lt;cols;j++){
              printf("%d  ",a[i][j]);
          }
      }              
  
      getch();
      return 0;
  }
  </code></pre>
  
  <p>I want something like a <code>5*5 matrix structure</code> but I want to manipulate each row as if they were a one dimensional array . Can someone tell me how to do that?</p>