With C++ you only need to use the keyword struct with the declaration of the struct interface, not with each use of struct as a parameter or as an object. Therefore, drop struct in each of the following two lines:

struct node create_node();
void delete_nodes(struct node *start_ptr);

and other extraneous places other than

Code:

struct node
{};

Secondly, compiling is different than running. Does the code provide the output you want. I suspect it's a bit difficult to say as you never attempt to use the list except to fill it and the delete it. If you do that I think you'll find an error that I made yesterday. That is, in order to change the value of a pointer in the calling function in a called function you need to pass the pointer by reference, not by value. To demonstrate this to yourself add the following line after the call to input_data() in main

and then handle the levels of indirection as necessary in input_data(). Post if you can't figure that out.

Third, to answer your question, create_node() returns a node, not a pointer to a node. Therefore you need a node to assign it to in main(). Since top_ptr is a pointer to a node, you need to derefence the pointer back to the node it points to by using the derefernce operator as you did, or have the return from create_node() be a pointer to a node, not a node, in which case you don't need to dereference top_ptr or top.

Fourth, note that your current code only creates and destroys a single node each run through the program. You will want to expand it to allow the user to add and delete more than one node per program at some point. That will will require use of loops.

I see that some of my points have already been reported from a slightly different perspective, so excuse the redunancy where it exists.

the node pointer is used to change the value at the address it is pointing to, not change the address the node is pointing to. Therefore, the pointer doesn't need to be passed by reference, it _is_ the "reference" used to change the value.