1. Create a structure, called track to hold the following information

    • Title of a track (up to 20 characters)

    • Artist Name (up to 30 characters)

    • Duration (up to 1000 seconds)

  2. Show how you would create a track called music and set its duration to 240 seconds.

  3. You see the line:

    mptr->duration = 100 ;

    What does this mean?













Answers
  1. struct track
    {
        char title[21];
        /* the extra 1 is for the terminator */
        char artist[31];
        int duration;
    }

  2. struct track music;
    music.duration = 240;

  3. It means that mptr must be a pointer to a track structure, and that you are setting the duration of the track mptr points to to 100.