Solution for Exercise 11-6
ex1106
#include <stdio.h> int main() { int a,b; b=16; printf("Before, a is unassigned and b=%d\n",b); a=++b; printf("After, a=%d and b=%d\n",a,b); return(0); }
Notes
* Because the ++
(increment operator) appears before variable b
at Line 9, its value is incremented first. Then the result is assigned to variable a
.
* Here is the program's output:
* It's important to remember when a value is incremented or decremented lest your code not behave as intended.
Copyright © 1997-2024 by QPBC.
All rights reserved