I've been struggling trying to make a linked list where I insert numbers in the following order " 1 2 3 "
and then print them out.
how ever I do something wrong couse nothing get printed at all
The problem is that p is not a nullptr when you call the function the first time, so whatever is in data is pure garbage could be pure garbage or just a default value, try replacing the first line in main with: List *p=nullptr;