-
struct
Hello guys,
I want to create a struct that lets say is the employee and contains some values for the employee
If i want to create n employees(The user says how many are the employees of the company) how do i do it?
Keep in mind i want to compare the values betweeen the employees
-
Code:
// one of them
struct employee {
char name[10];
// anything else you want to save
};
// many of them
struct employee employees[100];
> The user says how many are the employees of the company
Code:
struct employee *employees = malloc( howmany * sizeof(*employees));
In either case, you start with
employees[0].name