Lab 3 - 2D Array Linked List

Due: 5:00pm on Wednesday

The purpose of this lab is to add the tail index to a 2D array implementation of a linked list. The secondary purpose of this lab is to learn how to compile and edit C code, as opposed to C++ code.

Download the file 2d_array_list.c and compile it with the following command:

gcc -o lab3 2d_array_list.c
The gcc command invokes the C compiler. It uses the same command line options as g++. The file extension .c is used for C source code, while the extension .cpp is reserved for C++ source code.

You run the resulting executable the same as you would C++ code:

./lab3
The file contains a 2D array implementation of linked lists which does NOT have a tail index. Your task for this lab is to implement the tail index, as discussed in class on Monday. You will need to do the following things: All your code must be valid C code, not C++ code. Most of the C++ you learned in CMPS 221 (up to structures) is also valid C code. There are a few important differences however. You should familiarize yourself with C syntax now because some upper-division Computer Science classes are done with C instead of C++.

C code must use scanf() for input and printf() for output. You can NOT use cin or cout. See the provided main() for how to use scanf() and printf() in C.

Additionally, your comments must be in the /* comment */ format and cannot be // comment. And C does not support the bool datatype, nor the keywords true and false. You have to use the integer equivalents of 0 and 1 in C code, as the provided code does.

Email your updated source code to me.