This function converts a Boolean value to a string. point out possible runtime bugs.
#define TRUE 1
#define FALSE 0
char* bool2Str(boolean x)
{
char result[5];
if (x == TRUE)
strcpy(result, "TRUE");
if (FALSE == x)
strcpy(result, "FALSE");
return &(result[0]);
}
strcpy will dutifully write, but there's only space for 5.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With