Expressions

3. Expressions

3.1Why doesn'tthe code"a[i] = i++;" work?

3.2Under my compiler, the code"int i = 7; printf("%d\n", i++ * i++);" prints 49. Regardless of the order of evaluation, shouldn't it print 56?

3.3How couldthe code"int i = 3; i = i++;" ever give 7?

3.4Don't precedence and parentheses dictateorder of evaluation?

3.5But what about the&& and || operators?

3.8What's a ``sequence point''?

3.9Sogiven"a[i] = i++;" we don't know which cell of a[] gets written to, but i does get incremented by one.

3.12If I'm not using the value of the expression,should I use i++ or ++i to increment a variable?

3.14Why doesn't the code"int a = 1000, b = 1000; long int c = a * b;" work?

3.16Can I use ?: on the left-hand side of an assignment expression?


top