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

 

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++;

 

c.    What is the value of rec at the end of the loop?                    

 

If employee == 7500 and the size of the record is 20 then at the end of the loop the value of rec will be:

 

7500 + 3 * 20 = 7500 + 60 = 7560