I am able to ask a user for an input and insert it to a linked list. So the following will get 1 integer from user:
printf("Enter an integer: ");
scanf("%d",&value);
insert(value); // insert value to linked list
But I want to user to be able to enter many integers (as many as they want). Example: Enter an integer: 5 6 7 8 9
and add 5
to insert
then, add 6
to insert
and so on.
I read this post "reading two integers in one line using C#" and the suggested answer was to use an array of strings but I don't want to do that. I want every number entered by the user to be entered in a linked list.
main function :
int main(){
printf("Enter integer(s) : ");
scanf("%d",&num);
insert(num);
return 0;
}
thank you