I am getting a warning on the program I am coding and I dont know what the reason is.
Code:
// assigns a data type String
typedef char String[STRINGSIZE];
// Assigns a data structure for file contents
typedef struct CDInfo
{
String artist;
String album;
int numTracks;
} CDInfo;
Code:
// FUNCTION PROTOTYPE
void ReadMusicData(CDInfo);
Code:
// MUSIC FILE READING FUNCTION CALL
ReadMusicData(info); //error here
Code:
// MUSIC FILE READING FUNCTION
void ReadMusicData(CDInfo info)
{
// read in the title, author and then strip EOLNS
fgets ( info.artist, STRINGSIZE, inFile );
fgets ( info.album, STRINGSIZE, inFile );
info.artist [strlen (info.artist) - 1] = '\0';
info.album [strlen (info.album) - 1] = '\0';
fscanf(inFile, "%d", &info.numTracks);
printf("Artist: %s\n", info.artist);
printf("Album: %s\n", info.album);
printf("Number of tracks: %d\n", &info.numTracks);
}
Heres the warning:
c:\program files\microsoft visual studio\myprojects\music2\music2.c(106) : warning C4700: local variable 'info' used without having been initialized
I dont know how to initialize a struct but I did not think I had too. Have I missed something?