I have a second assignment that I cant seem to get right
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.
The code I have so far is
Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAXCHARS 5
typedef struct NUMBERS
{
int value;
struct NUMBERS *next;
} node_t;
int main()
{
int i, value;
char name[MAXCHARS];
for (i=0; i < MAXCHARS; i++)
printf("Enter five numbers, one per line.\n");
scanf("%d", &value[i]);
printf("Your five numbers are:\n");
for (i = 0; i < MAXCHARS; i++)
printf(" %d\n", value[i];
free(value);
scanf("%d", &i);
return 0;
}
I am getting errors on a couple of lines and I can't figure out what I am doing wrong