Still don't understand about char concatenation.
void setup() {
testCounter(3);
}
void loop() {
// put your main code here, to run repeatedly:
}
char testCounter(int countx){
char a[10];
strcpy(a, "COUNTER: ");
strcat(a, printDigits(countx));
return a;
}
char printDigits(int digits){
char a[3];
if(digits < 10) {
strcpy(a, "0");
sprintf(a,"%d",digits);
} else {
sprintf(a,"%d",digits);
}
return a;
}
Error: invalid conversion from 'char' to 'const char' [-fpermissive]* in testCounter
line:
strcat(a, printDigits(countx));
Don't understand this part of error.
printDigits
function return char, so... strcat
should be work. But why still error?
Please help...