I am teaching myself C and I seem to be getting incorrect output when running the program. I always get 'They are equal', even if they are not, also, the return value seems to only print the first word of whatever is inputted, how can I fix this?:
#include <stdio.h>
char var[0];
char var2[0];
int main(void) {
printf("Enter Var 1=> ");
scanf("%s", &var);
printf(var);
printf("\n");
printf("Enter Var 2=> ");
scanf("%s", &var2);
printf(var2);
printf("\n");
if (var == var2)
printf("They are equal");
else
printf("They Are not equal");
}
Aucun commentaire:
Enregistrer un commentaire