ECE 209 / CSCI 255 Assignment 7C

This is not a full assignment. It's one-half of one.

Due date

This assignment must be submitted as a single file named RLexec.c for Assignment 7C of the ECE 209.602 section on UNCA moodle by 11:45 PM on 2 December.

Your program should be written in standard ANSI C.

Getting started

Be sure you have read the RL Assignment overview.

Your task

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) ;
     *
     */

What should happen

Your program should now be able to print the variables in alphabetical order.

Suggestions

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.