Answers to Chapter 11 Review Questions -------------------------------------- 3. (a) #define MaxRealArray 100 double realArray[MaxRealArray]; (b) #define MaxInUse 16 bool inUse[MaxInUse]; # since we are not using the book's string library, you do not # need to answer part (c), but here is the solution just in case # you are curious: (c) #define MaxLines 1000 string lines[MaxLines]; 4. #define NSquares 11 int squares[NSquares]; int i; for (i = 0; i < NSquares; i++) { squares[i] = i * i; } 7. printf("Bytes for value of type int = %d.\n", sizeof(int)); printf("Bytes for value of type double = %d.\n", sizeof(double)); 9. NElements * sizeof(double) 20. Assuming 2 bytes are required to store an integer, the declaration int rectangular[2][3]; reserves the following block of memory: Address Array element +----------+ 1000 | | \ +----------+ > rectangular[0][0] 1001 | | / +----------+ 1002 | | \ +----------+ > rectangular[0][1] 1003 | | / +----------+ 1004 | | \ +----------+ > rectangular[0][2] 1005 | | / +----------+ 1006 | | \ +----------+ > rectangular[1][0] 1007 | | / +----------+ 1008 | | \ +----------+ > rectangular[1][1] 1009 | | / +----------+ 1010 | | \ +----------+ > rectangular[1][2] 1011 | | / +----------+