#include #include #include /* C has no classes; use struct instead */ struct Course { char name[80]; char number[32]; int crn; }; int main() { printf( "sizeof struct Course is %d\n", sizeof( struct Course ) ); struct Course c1; struct Course c2; struct Course * c3; /* dynamically allocate 1 struct Course */ c3 = (struct Course *)malloc( sizeof( struct Course ) ); int section = 1; strcpy( c1.name, "Operating Systems" ); sprintf( c1.number, "CSCI-4210-%02d", section ); c1.crn = 80569; strcpy( (*c3).name, "Operating Systems" ); sprintf( (*c3).number, "CSCI-4210-%02d", section ); (*c3).crn = 1234; c3->crn = 12345; free( c3 ); return 0; }