<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: Really need help with C program to calculate grades using linked lists! Please help?</title>
	<atom:link href="http://www.massemailinglist.com/2010/03/really-need-help-with-c-program-to-calculate-grades-using-linked-lists-please-help/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.massemailinglist.com/2010/03/really-need-help-with-c-program-to-calculate-grades-using-linked-lists-please-help/</link>
	<description>mass email list</description>
	<pubDate>Fri, 18 May 2012 14:33:09 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.5</generator>
		<item>
		<title>By: Ratchetr</title>
		<link>http://www.massemailinglist.com/2010/03/really-need-help-with-c-program-to-calculate-grades-using-linked-lists-please-help/#comment-2327</link>
		<dc:creator>Ratchetr</dc:creator>
		<pubDate>Sun, 21 Mar 2010 16:35:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.massemailinglist.com/2010/03/really-need-help-with-c-program-to-calculate-grades-using-linked-lists-please-help/#comment-2327</guid>
		<description>Dave - I think you're really missing the whole point about how a linked list works. You really need to go back and read that section of the textbook again.

You need at least 2 things to make a linked list work:
1) A pointer to the head of the list.
2) A link in each node of the list to the next node (where NULL means end of list).

You have neither. You declared a whole bunch of test_result structs or pointers (5 if I counted right), but none of them are acting as the Head pointer, and none are linked using the next pointer.

You need a head node:
struct test_result * Head = NULL;

When you allocate a node, you need to add to list (add to start, it's easier):
struct test_result *node = malloc(sizeof(struct test_result));
node-&gt;next = Head; // add to front of list
Head = node; // Make node the start of list.

average_finder needs a loop. You need to loop over all the nodes:
struct test_result *node = Head;
while(node != NULL)
{
 // do stuff with node
 node = node-&gt;next;
}</description>
		<content:encoded><![CDATA[<p>Dave - I think you&#8217;re really missing the whole point about how a linked list works. You really need to go back and read that section of the textbook again.</p>
<p>You need at least 2 things to make a linked list work:<br />
1) A pointer to the head of the list.<br />
2) A link in each node of the list to the next node (where NULL means end of list).</p>
<p>You have neither. You declared a whole bunch of test_result structs or pointers (5 if I counted right), but none of them are acting as the Head pointer, and none are linked using the next pointer.</p>
<p>You need a head node:<br />
struct test_result * Head = NULL;</p>
<p>When you allocate a node, you need to add to list (add to start, it&#8217;s easier):<br />
struct test_result *node = malloc(sizeof(struct test_result));<br />
node->next = Head; // add to front of list<br />
Head = node; // Make node the start of list.</p>
<p>average_finder needs a loop. You need to loop over all the nodes:<br />
struct test_result *node = Head;<br />
while(node != NULL)<br />
{<br />
 // do stuff with node<br />
 node = node->next;<br />
}</p>
]]></content:encoded>
	</item>
</channel>
</rss>

