Comparing a Char Z88
Posted: Thu Sep 02, 2021 7:14 am
I know this must be so easy, but I can't get it to work!
I have an unsigned char Hands[] which sometimes contains the letter 'Q' I want to do a check and if it contains 'Q' then print 'Qu' else print whatever is in Hands - But my code below doesn't work.
I also tried if (Hands=="q'){etc} - which didn't work either. I'm sure it must be something so simple that I'm doing wrong
I have an unsigned char Hands[] which sometimes contains the letter 'Q' I want to do a check and if it contains 'Q' then print 'Qu' else print whatever is in Hands - But my code below doesn't work.
I also tried if (Hands=="q'){etc} - which didn't work either. I'm sure it must be something so simple that I'm doing wrong
Code: Select all
for( i = 13 ; i < n ; i++ ) {
test = strcmp(Hands[i],'q');
if (test = 0){printf("qu");}
else{printf("%c ", Hands[i]);}
}