Hi!
i trying to take the same value from 2 arrays and then count how many time of it. However, when i compile, it run ok. but it did not print out the value of coutting. I did not know why, i had tried several times to fixing. please help me.
#include <stdio.h>
#include <stdlib.h>
int main() {
char *em[] = {"hello", "bunjour", "ccc"};
char *e[] = {"hello", "b"};
int i, j, count = 0;
for (i = 0; i < 10; i++) {
for (j = 0; j < 10; j++) {
if (strcmp(em[i], e[j]) == 0) {
count++;
}
if (em[i] == NULL) {
break;
}
}
if (e[i] == NULL) {
break;
}
}
printf("count %d\n", count);
return 0;
}