/* * structure1.c - basic structure */ #include #include int main(void) { struct EmpInfo // declare stuct with 2 elements { char name[13]; // char array of 13 chars int sal; // int sal }; struct EmpInfo emp1; // declare variable of struct type EmpInfo printf("Enter employee name: "); // prompt for input fgets(emp1.name, 81, stdin); // read from stdin // max of 81 chars // store at &emp1.name[0] printf("Enter employee salary: "); // prompt for input scanf("%d", &emp1.sal); // read from stdin // interpret as a digit // store at &emp1.sal printf("Employee NAME: %s\tSALARY: %d\n", emp1.name, emp1.sal); return 0; }