struct Employee
{
/* Employee details */
char name[MAX_NAME_LENGTH+1]; /* name string */
char sex; /* sex identifier, either 'M' or 'F' */
int age; /* age */
char job[MAX_JOB_LENGTH+1]; /* job string */
struct Employee *prev, *next;
};
static void menu_add_employee(void)
{
static struct Employee *employee_list = NULL;
{
struct Employee *new;
new = (struct Employee *) malloc ( sizeof(struct Employee) );
strcpy (new -> name, "Sadra Mostashar");
new -> sex = 'M';
new -> age = 20;
strcpy (new -> job, "Student");
/*add first employee to doubly linked list*/
new -> prev = NULL;
new -> next = employee_list;
employee_list = new;
free ( new );
}
static void menu_print_database(void)
{/*Here's my question, How do I print the above structure in this function by calling that structure?*/
struct Employee *employee_list;
printf("Name: %s\n", employee_list->name);
printf("Sex: %c\n", employee_list->sex);
printf("Age: %i\n", employee_list->age);
printf("Job: %s\n", employee_list->job);
}
nanosadra 0 Newbie Poster
Adak 419 Nearly a Posting Virtuoso
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.