Create a function contentOfTheHead
that returns the content of the head of the linked list. The argument of the function is aHead
. It is the pointer that contains the address of the head. If the function receives the nullptr
, then the function should return -777
. However, if the function receives a pointer to the head of a real linked list, then it should return the content. Your code should replace the text // ??? //
below.
long contentOfTheHead(ListNode* aHead){ if(aHead==nullptr){return -777;} // ??? // }