Hi, i am kind of new to c programming. So, i here want to get a clarification about boolean.
here is the part of the code:
this code seem to be wrong according to the tutorial i learnt. What it wrote was (strcmp(name, "David") == 0). please explain to me. I understood that =0 means false. Therefore, it supposed to be 1.Code:scanf ("%s\n", name); if (strcmp(name, "David") == 1) printf (" You are David");
Here is my second question :
which is the correct way to assign a string to an array?Code:char name[10] = "David"; OR char name[10]; strcpy(name, "David");
by the way, my programming tutorial taught me to use the second one. It did not mention about the first one.