Here is the question posed.

Create a structure that has one variable called value and one pointer to the list (making it a linked list). Prompt for 5 values from the keyboard as input and store them in the linked list. Print out the current contents of the list. Allow the user to add one more value to the linked list, and print the contents of the list again.

Here is my code:

Code:
```#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX 30
struct ValueList
{
char valuename[MAX];
struct ValueList *value;
};
struct ValueList *firstvalue;

int main()
{
void display();

firstvalue=NULL;
display();

return 0;
}

{
char value[MAX];
void insert(char *);

printf("Please enter 5 whole numbers, one per line");
printf("\nTo stop entering whole numbers, enter a single x\n");
while(1)
{
printf("Enter a whole number: ");
gets(value);
if (strcmp(value, "x") ==0)
break;
insert(value);
}
}

void insert(char *value)
{
struct ValueList *linear Locate(*char);
struct Valuelist *newnode, *here;

newnode= (struct ValueList *) malloc(sizeof(struct ValueList));
if (newnode == (struct ValueList *) NULL)
{
printf("\n\nCould not allocate enough space\n");
exit(1);
}
if(firstValue==NULL)
{
}
else if(strcmp(value, firstValue->value) <0)
{
}
else
{
here = linear Locate(value);
}

}

struct ValueList *linear Locate(char *value)
{
struct ValueList *one, *two;
one = firstValue;

if(two==NULL)
return (one);
while(1)
{
if(strcmp(value, two->value) <0)
break;
{
one = two;
break;
}
else
{
one = two;
}
}
return(one);
}

void display()
{
struct ValueList *contents;

contents = firstValue;
printf("\nThe numbers currently in the list are\n");

while(contents != NULL)
{
printf("%s\n",contents->value);
}
}```
Now I know I am supposed to add more values however the example from my textbook is garbage and I am suffering from a dislocated shoulder so I am really not liking coding with two semi functioning arms and hands.

Any help would be appreciated and I thank all of you for the help in advance.

Todd

2. I didn't read all the code
But here are some notes:
1. Don't cast malloc http://faq.cprogramming.com/cgi-bin/...&id=1043284351
2. is "linear Locate" a function name? Then it should be one word like linearLocate or linear_locate base on the naming conventions you choose
3. firstvalue=NULL; in your main you affectivly loose the pointer to your list making it unaccessible with a lot of memory leaks.

3. Code:
```#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX 30
struct ValueList
{
char valuename[MAX]; /* change valuename to value */
struct ValueList *value; /* change value to nextAddr */
};
struct ValueList *firstvalue;  /* change firstvalue to firstValue */

int main()
{
void display();

firstvalue=NULL; /* change firstvalue to firstValue */
display();

return 0;
}

{
char value[MAX];
void insert(char *);

printf("Please enter 5 whole numbers, one per line");
printf("\nTo stop entering whole numbers, enter a single x\n");
while(1)
{
printf("Enter a whole number: ");
gets(value);
if (strcmp(value, "x") ==0)
break;
insert(value);
}
}

void insert(char *value)
{
struct ValueList *linear Locate(*char); /* change linear Locate to Locate */
struct Valuelist *newnode, *here; /* change Valuelist to ValueList and
define another struct Valuelist pointer

newnode= (struct ValueList *) malloc(sizeof(struct ValueList));
if (newnode == (struct ValueList *) NULL)
{
printf("\n\nCould not allocate enough space\n");
exit(1);
}
if(firstValue==NULL)
{
}
else if(strcmp(value, firstValue->value) <0)
{
}
else
{
here = linear Locate(value);  /* change linear Locate to Locate */
}

}

struct ValueList *linear Locate(char *value) /* change linear Locate to Locate */
{
struct ValueList *one, *two;
one = firstValue;

if(two==NULL)
return (one);
while(1)
{
if(strcmp(value, two->value) <0)
break;
{
one = two;
break;
}
else
{
one = two;
}
}
return(one);
}

void display()
{
struct ValueList *contents;

contents = firstValue;
printf("\nThe numbers currently in the list are\n");

while(contents != NULL)
{
printf("%s\n",contents->value);