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
Tell me what is the need for an infinite loop in embedded systems?
Discuss the concept of yagni and explain something you did recently that adhered to this practice.
How are local and global variables are allocated by compiler.
What is solid?
Mention what are buses used for communication in embedded system?
Can a pointer be volatile ?
Tell me when one must use recursion function? Mention what happens when recursion functions are declared inline?
Explain what are the differences between analytical and computational modeling?
Tell me can a pointer be volatile?
Can you please explain the difference between mutexes vs semaphores?
What are the qualifiers in c?
Whose blogs or podcasts do you follow? Do you blog or podcast?
Do you know what is the use of volatile keyword?
What are the commonly found errors in embedded systems?
What is interrupt latency? How can you reduce it?