$30
Assignment 5 – (100 points)
Instructions
• Answer the questions individually. Group effort is not allowed.
• For this assignment, you are not allowed to use any library functions not
declared in stdio.h.
• Ensure that your code runs on remote.cs.binghamton.edu.
• Prototypes must be provided for all functions within the header file define.h.
• Code must be appropriately commented.
• Useful resources:
– Common linux commands: http://www.informit.com/blogs/
blog.aspx?uk=The-10-Most-Important-Linux-Commands
– http://c-faq.com/
– https://cdecl.org/
Questions
1. (100 points) You are to implement a function: Node *my reverse(Node
*head) that reverses a list beginning at Node *head. The return value of
this function is a pointer to the head of the newly-reversed linked list. A linked
list is a collection of Nodes that are connected to each other using pointers. The
last node in a list points to NULL.
The following definition of a Node is provided in define.h, and may not be
modified in your submission:
1
struct _Node {
union {
int n;
char c;
} val;
void *ptr;
int var;
};
typedef struct _Node Node;