Question: This is C Programming (not cpp! not C++, not C#) Please fill in the codes below //your code here. This is Arraylist with 2d array.
This is C Programming (not cpp! not C++, not C#) Please fill in the codes below "//your code here".
This is Arraylist with 2d array. Each word (alphabet only) is no longer than 50 characters. The maximum size of the list is 100. Your program should not contain main().
#include
typedef struct _list { char word[100][51]; // The 2D array for words int size; // Size of the arraylist } ArrayList;
// Initialize the arraylist as an empty list #1 // Set all values in word to null characters // Set size to 0 void arraylist_init_empty(ArrayList **list){ // Your code here
}
// Initialize the arraylist with an array of n words #2 // The first word is stored at word[0] // Suppose n <= 100 void arraylist_init(ArrayList **list, char arr[100][51], int n){ // Your code here }
// Insert a new word to the end of the list #3 #4 // If list is full, then do nothing void arraylist_insert(ArrayList *list, char *word){ // Your code here }
// Delete the last word from the list #5 #6 // If list is empty, then do nothing and return null pointer // Return the deleted word for non-empty list char* arraylist_delete(ArrayList *list){ // Your code here return NULL; }
// Return the size of the arraylist #7 int arraylist_size(ArrayList *list){ // Your code here return 0; }
// Free the list, if list is not NULL #8 // Assign NULL to the *list void arraylist_free(ArrayList **list){ // Your code here }
// The print function print the list in an output string #9 // Example: "haha Hello Yes " char* arraylist_print(ArrayList *list){ // Your code here return NULL; }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
