Lab-13

Announcements

Lab Activity

Lab 13: Drawing Data Structures Pictures

This lab is a paper-and-pencil lab.  Draw the pictures for each of the data structures below.  Each is worth ½ a point, for a maximum of 3.

1.  int numbers[5];

2.  char words[3][10];

3.  int *pNumbers;

pNumbers = (int *) malloc( sizeof( int) * 5);

4.  char *pLetters;

pLetters = (char *) malloc( sizeof( char) * 3);

5.  char **pWords;

pWords = (char **) malloc( sizeof( char *) * 3);

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

   pWords[ i] = (char *) malloc( sizeof( char) * 10);

}

6.  struct Student {

   char name[ 10];

   long UIN;

};

Student class[3];

Student *pStudent = &class[ 2];

Student *pOther = pStudent;