look at following code

void foo(void) {
unsigned int a = 6;
int b = -20;
int c = (a+b > 6) ? 1:0;
}
o/p is 1 why
explain promotion rules

Answer Posted / nitin sharma

Compiler will convert variable b to unsigned int b and then do the addition. Which will be greater than 6 and you got 1.

Is This Answer Correct ?    38 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the function of dma controlled in embedded system?

480


What is the need for having multibyte data input and output buffers in case of device ports?

464


Why continuous integration is important?

430


What is refactoring? Name three common refactorings.

553


Why are interfaces important?

494






Tell me what is microcontroller?

459


Who are the gang of four? Why should you care?

508


Explain the software analysis process, such as code analysis, code metrics, and system risk analysis or software reliability.

478


How can you ensure that debugging a program while it's being used will not affect its functionality?

573


Tell me what is the need for an infinite loop in embedded systems?

442


Why is model transformations used in the embedded system?

448


Tell me why is java mostly used in embedded systems?

435


Explain what is semaphore?

451


How are macros different from functions?

432


Explain the characteristics of embedded system?

454