Puzzle SL10


What does the following code write to the monitor?

#include <stdio.h>
int main( void )
{
  int a=1, b=2, c=3 ;
  printf("scope m: a=%d\tb=%d\tc=%d\n", a, b, c );

  if ( a )
  {
    int b = 66;
    printf("scope 1: a=%d\tb=%d\tc=%d\n", a, b, c );
    
    if ( b )
    {
      int c = 77;
      printf("scope 2: a=%d\tb=%d\tc=%d\n", a, b, c );
    }
    printf("scope 1: a=%d\tb=%d\tc=%d\n", a, b, c );
  }
  printf("scope m: a=%d\tb=%d\tc=%d\n", a, b, c );

  return 0 ;
}

As with P09, this puzzle is not particularly tricky . Just routine application of the rules will do.



Previous Page        Answer         Next Page         Home