I have searched but am unable to come up with a specific answer. What is the best or most efficient way to initialize a struct? Here is what the struct looks like that I am currently dealing with.
So I have been doing this:Code:typedef struct id3v1
{
char tag[3];
char title[30];
char artist[30];
char album[30];
char year[4];
char comment[29];
char track;
char genre;
} id3v1;
id3v1 id3v1_h;
But is this bad because it assumes that all of the variables are stored contiguously, or is it safe to assume this because that is the nature of structs?Code:for (i = 0; i < sizeof(id3v1_h); i++)
id3v1_h.tag[i] = 0;