Due: Friday, September 30, 2016, 10:00 am (start of the class)

Consider the following C program,

1    int main () {
2	
3      int i = 5;
4      int j = 0;
5	
6      for (int i = 0, j = 10; i < j; i++, j--) {
7        printf("P1: i = %d, j = %d \n", i, j);
8      }
9	
10     printf("P2: i = %d, j = %d \n", i, j);
11	
12     return 0;
13   }			

and answer following questions.

  1. What is the output of this program?
  2. Are the reference i and j on line 6 local or non-local?
  3. Are the reference i and j on line 7 local or non-local?
  4. Are the reference i and j on line 10 local or non-local?
  5. Draw the symbol tables for this program, using <name, type, line # >.

© 2016 Ying Li. Page last modified: .