5.0010.  Given the following sections of C code:

 

struct  emp

{  char lname[7], dept[5];

    short age, class;

    float salary;

};

 

void main()

{   struct emp employee[6];

     printf (“%lu\n”, &employee[2].class);   // The output would be 6420

 

                struct emp *rec = employee;

 

FORGET THE ANSWERS YOU OBTAINED FOR Parts a and b.

 

Suppose that after the above the statement printf(“%lu”, &employee[0]); 

yielded the output 7500.

 

Now, inside the program we find the code:

 

                for (i = 0; i < 3; i++)

                        rec++;

 

d.    At what address will variable rec be found?

 

UNKNOWN.

 

This may seem like a trick question, but it isn’t. No where in the program is an address given, and as we have said many times in the past, the Operating System assigns addresses at run time. Unless we print out an address, we do NOT know what it is.