When I run the program below, it prints \"one: 1\", instead of \"one : 1, two: 2\", as I had expected. Anyone know what\'s going on here? I am trying to create a function th
Without seeing your iterate function the problem is that head1 is pointing to the last element on the list, not the first. You probably meant the the last line of the add function to be:
return head;
and 2nd line of your program to be:
head1 = add(2, "two", head1);
But that will still probably give you your output in the wrong order, because your add function is adding the new element to the start of the list, not the end.