by
Athanassios Staveris-Polykalas , Secretary General of Telecommunications and Post - Hellenic Republic , General Secretariat of Telecommunications and Post - Hellenic Republic
yes, using dynamic memory allocation and pointers.
first you create a struct like:
struct list_el {
int value;
struct list_el *next;
}
typedef struct list_el item;
inside your main now:
main ()
{
item * curr, *head;
int i;
head=NULL;
for (i=1;ivalue=i;
curr->next=head;
head=curr;
}
curr=head;
//then you can print your list //
while(curr){
printf("%d\n\t",curr->value_;
curr=curr->next;
}
}
hope this helps