I was trying to make a program that will use a struct to take in 3 employee ID's, first and last names. But have to use a pointer for passing to the function. Here is the code I have, sorry as I am new to programming so there are a few flaws. Any tips would be appreciated.
Code:#include <stdio.h> struct employee { char firstname[40]; char lastname[40]; int id; }; typedef struct employee Employee[3]; /* Input the employee data interactively from the keyboard */ void InputEmployeeRecord(Employee *ptrEmployee); void main() { Employee e1; InputEmployeeRecord(&e1); } void InputEmployeeRecord(Employee *ptrEmployee) { int i=0; for(i=0;i<3;i++) { printf("Enter the employee ID") scanf("%d", Employee.id); printf("Enter the employee first name") gets(firstname); printf("Enter the employee last name") gets(lastname); } }



LinkBack URL
About LinkBacks



. It all works, I built another function to print it out and verify too, I like how you don't give the answer only assist, much better for learning.