Here is the whole code, the problem is in the 25th line. If I give the value withe strcpy, the code works. If I try to read the value with fgets, the strstr in the 23th line doesn't work. Thanks for your help.
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
typedef struct tk {
char name[60];
} tk;
int main() {
tk* array;
array = (tk*) calloc(1, sizeof(tk));
int k;
char c[60], h[60];
strcpy(array[0].name, "A B");
void find(char *c, tk *array) {
for (k = 0; k < strlen(array[0].name); k++) {
h[k] = tolower(array[0].name[k]);
}
printf("%s %s", array[0].name,c);
if (strstr(h, c) != NULL) printf("1");
}
fgets(c, 60, stdin);
k = 0;
for (k = 0; (k < strlen(c)); k++) {
c[k] = tolower(c[k]);
}
find(c, array);
free(array);
return (0);
}