Skip to content

Instantly share code, notes, and snippets.

@EvanGertis
Created February 5, 2019 13:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EvanGertis/79931057d925c029fbeed77fda07de27 to your computer and use it in GitHub Desktop.
Save EvanGertis/79931057d925c029fbeed77fda07de27 to your computer and use it in GitHub Desktop.
void createList(struct node *head)
{
int n, data;
// prompts.
printf("Enter the number of nodes that you would like insert ");
scanf("%d", &n);
// guard.
if(n == 0){
return;
}
// get the data for the nodes.
for(int i = 0; i < n; i++){
printf("Enter the data that you would like to store at node %d :", i);
scanf("%d", &data);
insertAtEnd(head, data);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment