So i Have an array with words and i want to search and find to that array for example words that have 5 letters, so I can copy them and put them to another dynamic array for further usage
[code]
int main()
{
/**/
char **wordarr, **wordpc;
int option=1, library, howmany, i,number, numwords=0,count=0;
//open the file
FILE *fp;
fp = fopen("file.txt", "r");
if (fp == NULL) {
fprintf(stderr, "File not found\n");
exit(1);
}
//counts the words in the file
int ch, letterCount = 0;
while((ch = fgetc(fp)) != EOF){
if(ch == ' ' || ch == '\n'){
count++;
}
else if(ch == ',' || ch == '.' || ch == '!' || ch == '?');
else
letterCount +=1;
}
printf("letterCount %d\ncount %d\n", letterCount, count);
//making the array
wordarr = (char**)malloc(sizeof(char*) * count);
for(i = 0; i<count; i++){
wordarr[i] = (char*)malloc(sizeof(char) * WIDTH);
}
//
//putting the words into the array
printf("\nWrite how many letters does the word have?\n");
scanf("%d", &number);
int len,*temp= NULL, *tempi= NULL;
//goes to the first array and searches for words with NUM characters
//stores the words to an array
for(i=0; i<count; i++){