1.

What is the result of the below code?

Answer»

void demo(void){ unsigned int x = 10 ; int y = −40; if(x+y > 10) { printf("Greater than 10"); } else { printf("Less than or equals 10"); }}

In Embedded C, we need to know a FACT that when expressions are having SIGNED and unsigned OPERAND types, then every operand will be promoted to an unsigned type. Herem the -40 will be promoted to unsigned type thereby making it a very large value when compared to 10. HENCE, we will get the STATEMENT “Greater than 10” printed on the console.



Discussion

No Comment Found