CPP - using * or & to return address
问题 I am writing a code to make a linked list. one of the function I wrote in order to make a linked list easier in the main function was[node is the name of a struct conatains a.data b.pointer name next) : node& create_node(int value) { node newitem; newitem.data=value; newitem.next=NULL; return (newitem); }; When I write the function like this everything is ok but I want to write the function header as : node * create_node(int value) But when I write it that way and I write return *newitem; I