I'm trying to perform a deep copy of a linked list and print out the length and sum of the copied linked list, however, there is some kind of problem and I can't pinpoint it.
the line: new listrec (*copy) creates an exact copy of the copy argument, however, the ->next member of this copy is still the same as the original copy member's ->next, so we need to iterate through all the items in the linked list creating copies, which is what we are doing with the:
NOTE: you should probably replace nullptr with NULL in that function seeing as you are using NULL, nullptr means null pointer but its not the same as NULL