Okay my assignment is to create a program that accepts a user input for 5 values and stores them in a structure and then prints those 5 values back and allows for one more value to be inputted. I have created my structure but am having trouble with the use of pointers and how to get those five values stored. My C programming book is not of much help since it doesn't have an example for user input into a structure.
My basic problem is the understanding of how do use pointers and store them in a structure.
Thanks in advance for any help given.
PHP Code:
#include <stdio.h>
struct oomba
{
int value;
struct oomba *next;
};
int main()
{
struct oomba Val;
oomba *first
printf("Please input the value 1");
scanf("%d",Val.next);
printf("\n\nPlease input the value 2");
scanf("%d",Val.next);
printf("Please input the value 3");
scanf("%d",Val.next);
printf("\n\nPlease input the value 4");
scanf("%d",Val.next);
printf("\n\nPlease input the value 5");
scanf("%d",Val.next);
first = &Val.next
printf("Your first five values are %d \n%d\n%d\n%d\n%d", *Val.next, *Val.next, *Val.next, *Val.next,*Val.next);
return 0;
}