#include #include #include struct Staff { char name[50]; int age; float payrate; }; struct Staff JJ; void printStaff(struct Staff s) { printf("Staff name: %s\nAge: %d\nPayrate: %f\n", s.name, s.age, s.payrate); } void printStaffPtr(struct Staff * s) { printf("Staff name: %s\nAge: %d\nPayrate: %f\n", s->name, s->age, s->payrate); } int main(void) { int i; struct Staff KK; struct Staff staff[5]; struct Staff * ptr[7]; strcpy(JJ.name,"John Smith"); JJ.age = 19; JJ.payrate = 25.37; printStaff(JJ); KK = JJ; printStaff(KK); strcpy(KK.name, "Anna Smith"); printStaff(KK); for (i=0; i<5; ++i) { staff[i] = JJ; printStaff(staff[i]); } for (i=0; i<7; ++i) { ptr[i] = (struct Staff *) malloc(sizeof(struct Staff)); *ptr[i] = JJ; printStaffPtr(ptr[i]); } return 0; }