For some reason C doesn't like a global structure definition. I have it set up like this:
Code:
struct EDFSection
{
char Param[20];
int Label, SFactor, SigBits;
int Bit30, Bit31;
} ;
int
main (void)
{
EDFSection Sec;
........
Sec.Param = Temp[1];
Sec.Label = atoi(Temp[2]);
Sec.SFactor = atoi(Temp[3]);
Sec.SigBits = atoi(Temp[4]);
Sec.Bit31 = atoi(Temp[5]);
Sec.Bit30 = atoi(Temp[6]);
The array Temp contains strings of a fixed length. I tried writing a function to print the structure, as outlined in FAQ > Prelude's Corner > All about structures
But it won't cooperate.
Here's the function:
Code:
void print_Struct ( struct EDFSection sec )
{
printf ( "%s\t", sec.Param);
printf ( "%d\t", sec.Label );
printf ( "%d\t", sec.SFactor );
printf ( "%d\t", sec.SigBits );
printf ( "%d\t", sec.Bit31);
printf ( "%d\t", sec.Bit30 );
}
Even declaring the structure inside the main function didn't work. What's missing?