-
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)
-
-
Show how you would create a track called music and set its duration to 240 seconds.
-
You see the line:
mptr->duration = 100 ;
What does this mean?
Answers
-
struct track
{
char title[21];
/* the extra 1 is for the terminator */
char artist[31];
int duration;
}
-
struct track music;
music.duration = 240; -
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.