During my preparation to exam on ANSI C I have encountered the following question -
Is following statement valid?
If not, please make required changes to make it valid.
The original statement is: test(i++,i++);
it isn't valid because the behaviour is undefined according to K&R p202
The order of evaluation of arguments is unspecified
But can I change it to the following statement? test(i+=2, i+=3)
?
The problem that I haven't seen such record in K&R or any other source. But XCode compile it and run without any warning.
Both are valid statements, i.e. legal C, and in both cases, the behavior is undefined.