Section A:

1.      FALSE - regular comparison

2.      TRUE  - the value of the expression is 3 (see question 7)

3.      Before: c == rubbish (not initialized)
        After : c == 7

4.      x == address of a
        c == 3 (what's at x, i.e. what's at the address of a)
        b = &x; will not compile ( b is an int, &x is a pointer)

5.      *str + 3  is a char, value 'L' (*str == 'I', 'I' + 3 == 'L')
        str[6]    is a char, value ' ', between "a" and "string"
        &str[6]   is a string (pointer to char) = " string"
        str       is a string = "I am a string"
        str[strlen(str)] is char.  strlen(str) = 13, str[13] == '\0'

6.      there was no 6.

7.      FALSE is INTEGER ZERO
        TRUE is INTEGER of ANY non-zero value (note *ANY*)

8.      char x is a single char ... one byte
        char* x = "ABC"  x is a pointer (4-bytes) and the literal "ABC"
                has a '\0' therefore is 4-bytes TOTAL is eight bytes

Section B

1.      int xxx(char * s)    Determines the length of the string
        strlen() in stdio.h

2.      void yyy(int * x, int * y) swaps the ints to which the parameters point
        no standard library function does this

Brian Perry




