#include #include #include "list.h" int main(int argc, char *argv[argc+1]) { struct listitem root; // we always have a 0th element in argv (its the program name) root.data = argv[0]; // Keep a reference to where we're at. We'll need this for constructing // more pieces. struct listitem* current; current = &root; // Whats different about this loop? for (int i = 1; i < argc; i++) { // Make a new element struct listitem* new = malloc(1 * sizeof (struct listitem)); // Zero it all out *new = (struct listitem){0}; new->data = argv[i]; current->next = new; // Move current pointer to new current = new; item_print(new); } current = &root; while (current->next) { item_print(current); current = current->next; } return EXIT_SUCCESS; }