As others react, currentChar is a pointer to char or char * , but a string to C is char [] or const char * .
One way to use strcat to concatenate char string in is to create a minimal string and use it to convert char to string.
Example:
Creating a simple line with 1 character and the suffix '\ 0' ;
char cToStr[2]; cToStr[1] = '\0';
Application to your question:
char * string = ""; char currentChar = 'B';
cToStr will accept the string "B":
cToStr[0] = currentChar;
And strcat will work!
strcat ( string, cToStr );
gagallo7
source share