I've to write a program which gets a colour from user.Users will enter the colour's name if the colours is exist in my string,program will give a msg.If it doesn't exist give an error msg and stop program.I've already write a code but it doesnt works accurately.
int i,j;
void getColours(char codes[10][7]);
int _tmain(int argc, _TCHAR* argv[])
{
char colours[10][7]={"black","brown","red","orange","yellow","green","blue","violet","gray","white"};
getColours(colours);
}
void getColours(char codes[10][7]){
char colour[3][7];
printf("Enter the colours:\n");
for(i=0;i<3;i++){
printf("Colour %d:\n",(i+1));
scanf("%s",&colour[i][7]);
for(j=0;j<10;j++){
if(colour[i][7]==codes[j][7])
printf("Valid\n");
else{
printf("invalid\n");
break;
}
}
}
}