Hey all. I'm writing a program involving strings. I can get the user to input the information, however, I am getting stuck when trying to test the user's information.
I want to know why I can't perform the bolded code? I want to test if the color the user input is equal to the color I type in "quotes".
Code:
char color1[STRING],
color2[STRING],
color3[STRING];
char holder;
int a, b, c;
printf("Enter the colors of the resistor's three bands, beginning with\nthe band nearest the end. Type the colors in lowercase letters\nonly, NO CAPS.\nBand 1 => ");
scanf("%s", color1);
printf("\nBand 2 => ");
scanf("%s", color2);
printf("\nBand 3=> ");
scanf("%s", color3);
if (color1 = "black")
a = 1;
if (color1 = "brown")
a = 2;
printf("\n%f", &a);
return (0);
}