What will be the value of c= a- (b++)*(--a) where a = 5 and b = 3.
Answers
Explanation:
Don’t listen to these other guys. Their answers are naive and assume that you (or the people who will be compiling your code) are using a particular implementation of C (case in point, their answers are all inconsistent). The actual answer is that there is no answer. The specification leaves this ambiguous on purpose, as it does with many things that you really shouldn’t be doing regardless of whether it’s defined or not. This type of grey area is called undefined behavior, and it is the source of many memory-related bugs (I’m sure you are all-too-familiar with the words “Segmentation Fault”).
Specifically, this is a form of undefined behavior involving sequence points. Sequence points are essentially the things that divide “units of work” unambiguously. I.e. the semicolon/brackets separating two statements (foo(); foo2(); — 1 seq point divides 2 expression-statements), a