/* * structure3.c - an array of sturctures */ #include int getans(void); // prototype getans: takes nothing, returns int int main(void) // header of funciton main { struct EmpInfo // declare struct with 6 elements { char first[20]; char last[20]; char phone[20]; char email[30]; int sal; int yearhired; }; // don't forget the semicolon int ii, jj; // declare counters struct EmpInfo emp[20]; // declare array of 20 elements, of type struct EmpInfo for(ii=0; (ii ? getans() : 1); ii++ ) // initialize ii to zero // Conditiona: evaluate if ii is TRUE // if TRUE, call getans() and evalueat returned result // else return 1, and evaluate. // If the outcome is TRUE, do block // incremnt ii { printf("Enter employee's first name: "); scanf("%s", emp[ii].first); // read from stdin, store in array at &emp[ii].first[0] printf("Enter employee's last name: "); scanf("%s", emp[ii].last); // read from stdin , store in arry at &emp[ii].last[0] printf("Enter employee's phone number: "); scanf("%s", emp[ii].phone); // read from stdin , store in arry at &emp[ii].phone[0] printf("Enter employee's email address: "); scanf("%s", emp[ii].email); // read from stdin , store in arry at &emp[ii].email[0] printf("Enter employee's salary: "); scanf("%d", &emp[ii].sal); // read from stdin , store in int at &emp[ii].sal printf("Enter the year the employee was hired: "); scanf("%d", &emp[ii].yearhired); getchar(); // clear input buffer } printf("\n\n"); for(jj=0; jj