title: How do i read from a text file and allocate memory space using malloc for a 2d string array for each word in the text file
body: <p>i am new to coding and am having a problem with the following.</p>
  
  <p>I am required to read from a text file, each row will contain:
      command arg1 arg2 arg3...
      command arg1 arg2
      command
      command arg1 arg2 ... arg9
  etc</p>
  
  <p>What i am trying to do is read this entire file into a 2D string array called array using malloc. This way if i were to do:
      array[0][0] i would access command arg1 arg2 arg3
      array[1][0] i would access command arg1 arg2
  and so on.</p>
  
  <p>I also know there is a max of 100 rows and 256 characters per line. Below is how i attempted to declare my malloc however when trying to allocate strings to the 2d array, it only allocated single characters.</p>
  
  <p>I dont quite understand how to do this, detailed explanation would be greatly appreciated</p>
  
  <pre><code>int row = 100;
  int col = 256;
  int **array;
  array = (int**)malloc(row*sizeof(array));
  
     if(!array){
     perror("Error occured allocating memory");
     exit(-1);
     }
  
  for(int i = 0; i&lt;row;i++){
  array[i] = (int*)malloc(col*sizeof(array));
  }
  </code></pre>