(C++) If statement not effective
- by Galileo
void spriteput(int x,int y, int stype)
{
char sprite1[5]="OOOO";
char sprite2[5]="OOOO";
char sprite3[5]="OOOO";
char sprite4[5]="OOOO";
if (stype == 1)
{
char sprite1[5] = " OO ";
char sprite2[5] = "OOOO";
char sprite3[5] = "OOOO";
char sprite4[5] = " OO ";
mvprintw(2,y,"%s \n",sprite1);
}
mvprintw(x+1,y,"%s \n",sprite2);
mvprintw(x+2,y,"%s \n",sprite3);
mvprintw(x+3,y,"%s \n",sprite4);
}
If I'm correct that block of code should print out on a NCURSES screen
OO
OOOO
OOOO
OO
Instead however, it prints out the default text (the first char statements). Can anyone tell me why this is? The "printw" statement inside the If-block prints out the proper text, so it's being assigned correctly. Thank you in advance.