Given partial C code below: a) Write function definition for AddData that will create and initialize a
Question:
Given partial C code below: a) Write function definition for AddData that will create and initialize a new node of type struct newData. This function will return the address of newly created node. #include #include #include b) Write C code in main function to sum all the numbers in the basic linked list. struct newData int value; char english [50]; struct newData next }; c) Write C code in main function to prompt user for a number between 0-5. Based on the number entered, search the linked list for the English equivalent and display it on the screen. Sample execution is shown in figure below. void List (struct newData *Current) ! Current->next = AddData(1, "One"); Current = Current->next; Current->next = AddData(2,"TWO"); Current Current->next; Current->next - AddData(3, "Three"); Current = Current->next; Current->next = AddData(4, "Four"); Current = Current->next; Current->next = AddData (5, "Five"); Current = Current->next; }; Sum of the numbers in the linked list is 15 Please enter a number between 0-5 3 The English equivalent of 3 is Three int main() struct newData *Head=NULL, "Current=NULL; Head = Current = AddData(0, "Zero"); List (Current); int sum=0; //Write C code for Part (b) printf ("Sum of the numbers in the linked list is $d ", sum); //Write C code for Part (c) return 0; }