title: c reading from file into an array and splitting
body: <p>i have a certain txt file(for instance - dic.txt) in which words appear in this order:</p>
  
  <pre><code>hello - ola - hiya \n
  chips - fries - frenchfries \n
  </code></pre>
  
  <p>I need to read the contents of the file into an array of string arrays:
  for instance:</p>
  
  <pre><code>array[0]  : [hello,ola,hiya]
  array[1]  : [chips,fries,frenchfries]
  </code></pre>
  
  <p>I was thinking of using <code>strtok</code> in order to split each line in the file into a string (after copying the entire file into a string and calculating the number of lines),but i could not figure how to split each line (<code>"hello - ola - hiya \n"</code>) into the words,and storing each array into the array (an array of strings within an array).</p>
  
  <p>I was considering using <code>malloc</code> in order to allocate memory for each line of words,and storing the pointer to the string's array into the array,but i will be glad to receive any suggestions.</p>