When the function definition that includes a _Bool-type parameter is written in the K&R format, an assembly code that assigns the argument value to the _Bool-type parameter without change is generated. Therefore, if the _Bool-type
argument has a value other than 0 or 1, a value which is neither 0 nor 1 will be set to the parameter.
void sub(); signed char c; void func(void) { sub(2); } void sub(b) // 2 is set to parameter b. _Bool b; { if (b == 0 || b == 1) { c = b; } else { c = -1; // -1 is set to c. } } |
Write the function definition including a _Bool-type parameter and the function declaration in the function prototype
format.