Reputation: 14834
so I'm implementing this chess program on C++ and I'm trying to integrate to winboard protocol...one of the functions that they say I need to write to do so should have the following signature:
char *MoveToText(MOVE move); // converts the move from your internal format to text like e2e2, e1g1, a7a8q.
my question is....the text formats are something like e2e2....but the return type of that function is char...and as far as I can understand it, char is just one single character....
so how come are they telling me to use this signature?
or am I mistaken and in fact char can also store multiple characters such as e2e2, e1g1 etc?
Upvotes: 0
Views: 227
Reputation: 7480
It returns pointer to char, which is basically a c-string.
Take a look at this tutorial: http://www.cprogramming.com/tutorial/lesson9.html
Upvotes: 1
Reputation: 75130
Yeah, in C, a char* points to an array of characters. C treats arrays of characters as strings, terminated by a null byte.
Upvotes: 2