title: Parsing a huge text file gives me a segmentation fault
body: <p>I am trying to parse a relatively big text file in C. I cannot use <code>malloc</code> or <code>realloc</code>. Words should be tokenized based on <code>"/"</code> as you can see. However the code below gives me a segmentation error even if <code>i</code> change the size of the array.</p>
  
  <pre><code>char buf[1000];
  char *token;
  char tags[500][1000];
  FILE *fp = fopen("file.txt", "r");
  
  for (i = 0; fgets(buf, sizeof(buf), fp);) {
  
              token = strtok(buf, " /");
              while (token != NULL) {
                  strcpy(tags[i], token);
                  i++;
                  token = strtok(NULL, " /");
              }
          }
  </code></pre>