I'm trying to create in Texas Instrument CCS a string in C like this : {steps: nSteps}
in order to send it as a json, nSteps
is an int
.I want to convert into a string as well with the following code:
void jsonSteps(char* stepstr, int steps)
{
char x[3];
const char s1[10], s3[10];
char s2[10];
itoa(steps,x,10);
s1[]="{steps:";
s3[]="}";
s2 = strcat(s1, x);
stepstr = strcat(s2, s3);
}
I have this error in
s1[]="{steps:";
and
s3[]="}";
I receive an error
"#29 expected an expression"
and also
" #169-D argument of type "const char *" is incompatible with parameter of type "