Puzzle SL11


What does the following code write to the monitor?

#include <stdio.h>

int funct( int a, int b )
{
  int c=3 ;
  printf("scope f: a=%d    b=%d    c=%d\n", a, b, c );
}

int main ( void )
{
  int a=77, b=99;
  
  funct( 1, 2 );
  printf("scope m: a=%d    b=%d\n", a, b );

  system("pause") ; /* Remove if not needed */
  return 0 ;
}

The two parameters a and b are defined in the parameter list of the function, and so have block scope for the block of that function. (Such a block is sometimes called a function body.) The parameters are assigned values 1 and 2 when main() calls the function.



Answer         Next Page         Previous Page Home