This is not a full assignment. It's one-half of one.
This assignment must be submitted as a single file named RLexec.c for Assignment 7C of the CSCI 255 section on UNCA moodle by 11:45 PM on 2 December.
Your program should be written in standard ANSI C.
Be sure you have read the RL Assignment overview.
Modification C is performed in the listByNameRL
function
within
RLexec.c.
In this case, you pretty much write an entire function.
/* RL Modification C: * * List the RL variables in alphabetical order. * * This requires a doubly-nested for-loop. * The outer loop is a for that passes through the 26 header nodes. * (Don't print the actual header nodes. They contain no data.) * The inner loop passes through the nodes on each of the * chains. * * This original code contined 10 lines, but three of them * were the following fprintf which you should uncomment * fprintf(f, "%" RLVARF ": %" RLCONSTF "\n" , printNode->variable->value.Target, printNode->value) ; * */
Your program should now be able to print the variables in alphabetical order.
This is pretty much your vanilla linked list traversal within your vanilla array traversal.
If you are having trouble getting started, try going through the 26 header notes
and printing the indexes of those that have an actual list, that is, the headers that don't
point back to themselves. (Better yet, if the i
'th note
has an actual list, print the character 'A'+i
.)
If that works, try printing the variable stored in the first node of these lists.