Puzzle SL34

Will the following code compile?


/* --- rect.h --- */
void setWidth( int w );
void setHeight( int h );
int getArea();

/* --- rect.c --- */
static int width = 0;
static int height = 0;

void setWidth( int w )
{
  width = w;
}

void setHeight( int h )
{
  height = h;
}

int getArea()
{
  return height*width;
}

/* --- mainRect.c --- */
#include <stdio.h>
#include "rect.h"

void main()
{
  height =  4;
  width = 3;

  printf("Area: %d\n", getArea() );

}

Note that extern has been removed from some of the declarations.



Answer         Next Page         Previous Page Home