Hi again. Having quite a number of problems with topics in title.
My function is meant to do the following.
> strcmp textblock with wordlibrary.
> If the element of 'wordlibrary' isn't empty (hence the != 0 - i initialised 'wordlibrary[][]' = {0}), and if 'strcmp' says theres no match, then it 'strcpy' 'textblock' into the first element of 'wordlibrary'.
> If the word is repeated it just increase it's count.
The errors i get are :Code:char mytext[21] = {"my dog dog bill"}; char textblock[21] = {0}; char wordlibrary[10][21] = {0}; int frequency[10] = {0}; int wordplace(char textblock[], char wordlibrary[][], int frequency[]){ int f = 0; //f is for word library and counter while ((wordlibrary[f]<= 10) && (wordlibrary[f]!= 0)){ if((strcmp(textblock,wordlibrary)) == 1){ strcpy(wordlibrary[f], textblock); frequency[f]++; f++; } if((strcmp(textblock, wordlibrary)) == 0){ frequency[f]++; } } printf("%s\n %s", wordlibrary, frequency); return 0; }
1. 'wordlibrary' missing subscript
2. '<=' : no conversion from int to char
3. '<=' : char [1] differs in levles of indirection from int
4. 'strcmp': cannot convert parameter 2 from char [][1] to const char *
5. Same as 4.
6. end of file before the left brace '{' at....address.
Sorry to be such a fuss. I HAVE tried to repair this myself, but i can't fix what i don't fully understand.
Any advice/help would be much appreciated.
Thank You.



LinkBack URL
About LinkBacks


