Is it possible to store * and # in an array? I thought I could do this through the data type char. On top of that I was wondering if I could check the array elements to see if the element equaled that character, but I don't think that's possible.

Basically I have the following trial if someone could help me. I am still writing the pseudo code for my real program but I am trying to make sure I understand this because otherwise my pseudo code is all wrong and I am getting nowhere.

My code is the following:

char play[3];         // here i am trying to declare the array
play[2] = "*";       // set the 3rd element equal to the *

if(play[2] == "*")   // if it equals * then display
cout << "That seat is taken." << endl;

i dont think you should assign a char inside double quotes. Try

play[2] = '*'
if (play[2] == '*')

i dont think you should assign a char inside double quotes. Try

play[2] = '*'
if (play[2] == '*')

thanks that worked ;-D

This question has already been answered. Start a new discussion instead.