c strcmp() with array of strings : <p>I am trying to count the amount of times which any word is repeated in the words[] array. I already have i, j, num_words and the words array initialized. The words array is type char *words[n]. The frequency[] array runs parallel to the words[] array and keeps track of the number of times each word appears. The program compiles but when it runs i get a segmentation fault. The problem is coming from the following section of code: </p>

<pre><code>    int frequency[1000] = {0};
    for(i = 0; i &lt; num_words; i++){
            for(j = i+1; j &lt; num_words; j++){
                    if(strcmp(words[i], words[j]) == 0){
                          freq[i]++;
                    }
            }
    }
</code></pre>

<p>I've been playing around with this for a while but i have no idea what is wrong with this bit of code. </p>
