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
What is difference between using a macro and inline function?
How do you learn about the latest technology trends?
How does combination of functions reduce memory requirements in embedded systems?
What is the task of the pre-processor?
What elements of oo design are most prone to abuse? How would you mitigate that?
What is a 'const' variable?
What is return type of isr?
Tell me can a variable be both const and volatile?
Can structures be passed to the functions by value?
How does input/output bus functions?
Tell me about 3 times you failed.
Can you name any code testing tools?
Why is model transformations used in the embedded system?
List out various uses of timers in embedded system?
How to create a child process in linux?