c - Dynamic data structure with scanf -


i have basic question, patience.

i have dynamic data structure integer value , pointer next structure. using scanf user input 5 values add structure , trying print output @ end. having trouble syntax input structure. have looked around stackoverflow , google, no avail (probably because basic!)

here code:

#include <stdio.h>  struct list {     int value;     struct list *nextaddr; };  int main() {     int int1, int2, int3, int4, int5;      printf("please enter first integer: ");     scanf("%d", int1);     struct list t1 = {int1};      printf("please enter second integer: ");     scanf("%d", int2);     struct list t2 = {int2};      printf("please enter third integer: ");     scanf("%d", int3);     struct list t3 = {int3};      printf("please enter fourth integer: ");     scanf("%d", int4);     struct list t4 = {int4};      printf("please enter fifth integer: ");     scanf("%d", int5);     struct list t5 = {int5};      struct list *first;      first = &t1;     t1.nextaddr = &t2;     t2.nextaddr = &t3;     t3.nextaddr = &t4;     t4.nextaddr = &t5;     t5.nextaddr = null;      printf("%i\n%i\n%i\n%i\n%i\n",first->value,t1.nextaddr->value,t2.nextaddr->value,t3.nextaddr->value,t4.nextaddr->value);      return 0; } 

how can user input structure?

scanf should address of integer in: scanf("%d", &int1);


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -