2d array conversions

I am creating a snakes and ladders game and i want to create the snakes and ladders as strings first to distinguish between them! My board is a 2d char Array and i dont want to change that as my whole program is based on that! If anyone could help it would great.


string s1="s1";
board[7][2] = s1.c_str();
board[8][8] = char(192);

I've tried that but it isnt allowing me to do that any suggestions ?
board[7][2] = s1.c_str();
you are trying to assign char* to char.
Use chars instead of strings.
See im not sure what the difference is between char* and char
but the reason i want to do it this way is so i can have it easy for the user to see which snake/Ladder is which and using characters i cant have more than 1 character!!

I want it like S1 (start of snake)
s1(End of snake)

S2(start of 2nd snake)
etc
char is a character type (Something like 'x', 'S', 'n' and others) and can hold a single character (it cahhot contain "s1" since it is 2 (actually 3) characters). char* is a pointer type. It points to memory area where char is located. The difference is the same as note with address vs building. You have two choices:
a) Use single characters.
b) Change array type.

Note: if you will change array type you should not use c-strings. They are evil and probably lead to different kind of errrors.
Okay thanks for clearing that up for me!! i think im just going to have to take a different approach to this thanks anyway!!
Topic archived. No new replies allowed.