I am newbie in C. I do not know why I am getting this error and how to fix it?
void FPS_PRINT_ENROLLED(){
int checkNum = 0;
int ID = 0;
int num_Enroll = 0;
num_Enroll = Available_ID();
char strNum[3] = 0;
itoa(num_Enroll, strNum);
uint32_t numLen = strlen((char *)strNum);
UART_send_A3("Number of Stored Prints: ", 25);
UART_send_A3(&strNum, numLen);
}
The error message is: array initializer must be an initializer list or string literal
Please see the attached screenshot of the error message. Also, the c file is attached.
By the way, this is in PSoC Creator 4.1 which uses C language.
This line creates a three character string. You then use it as a string with the function strlen and the uart_send.
As a C string it must be terminated with a null character, so you only have two usable characters. It must also be initialised as a string, the compiler is telling you that you haven't done this correctly.
Try something like one of these lines