I'm currently learning C and I have this question...
char name[6] = "Pedro";
char test[25];
printf("Insert a name: ");
fgets(test, 25, stdin);
if(!strcmp(name, test))
puts("They are equal...");
During the execution, strcmp doesn't return 0 when I insert the value "Pedro" in the array "test"... I know the array "test" have a size of 25 instead of 6, but since C dettects the end of a string with '\0', how can I use the fgets in this situation?
Thank you very much...