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

Why is it better to use multi-threading polling instead of a single threading model?

575


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

435


Why is it better to use multi-threading polling then single threading model?

497


What software configuration management tools are you familiar working with?

416


Describe a software development life cycle that you've managed.

449






Mention how I/O devices are classified for embedded system?

543


How to implement a fourth order butter worth lp filter at 1 khz if sampling freuency is 8 khz?

479


How do you learn about the latest technology trends?

425


Tell me what is the difference between hard real-time and soft real-time os?

446


What is your experience with technical documentation?

560


Explain difference between risc and cisc processor?

464


Tell me why do we need virtual device drivers when we have physical device drivers?

512


What is inversion of control?

470


Explain the difference between mutexes vs semaphores?

471


Tell me what is microcontroller?

453