Page 1 of 1

(C language ) /* Use ll.h and ll.c to complete the program fe-v2.c */ #include "ll.h" /* 1- Define a structure data typ

Posted: Fri May 20, 2022 10:48 am
by answerhappygod
(C language )
/* Use ll.h and ll.c to complete the program fe-v2.c */
#include "ll.h"
/* 1- Define a structure data type Employee that contains the following fields:
* ID of integer type
* name of textual type (max length is 20 letters)
* salary of floating point type
2- Define a global linked list variable */
/* 3- Write the function load_from_file that takes a file name as parameter and
reads the file contents into the global linked list.
void load_from_file(const char* fn);
The first integer of the file stores the number of Employee records, then
the actual records are stored. */
/* 4- Write the function split_in_half that takes three parameters of type linked
list: input, left, right
void split_list(LinkedList* input, LinkedList* left, LinkedList* right);
It splits the first linked list input in halves,
stores copies of the nodes of the first half in the second linked list left, and
stores copies of the nodes of the second half in the third list right
If the input list has odd number of nodes, make the second linked list left longer. */
/* 5- Write the function to_string that takes a parameter of type void*
char* to_string(void* e);
when pointer to Employee record is passed, it returns the employee's name
as a string. */
/* 6- Write a main function that tests all of the above functions */
/* Bonus: write the function is_cyclic that takes a linked list as a parameter and determines
whether is contains a loop
int is_cyclic(LinkedList* list);
the list contains a loop if the pointer (next) of its last node points to some previous
node instead of NULL */