On Tue, Mar 15, 2022 at 4:41 PM Thomas Bushnell BSG
<tbushn...@google.com> wrote:

> Not in the normal implementation it doesn't. Typically it might be:
>
> type element struct {
>   value int
>   next *element
> }
>
> next is a pointer to an element, not a pointer to a pointer. That element 
> contains within it a pointer, but next is not a pointer to a pointer. If it 
> were, it would be declared with two stars.

Although linked lists usually do contain a payload, as you note, I
consider `type peano *peano` a payload-less linked list. Or a linked
list with zero sized payload one could also say. And once a node
contains zero bits of a payload, it contains only the link field. And
a struct with a single field is another interesting case that can be
abstracted out. Numbers 0 and 1 make many things much more interesting
;-)

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAA40n-XxedfcZfzOUVJE%3DV5kxn6b6MWqqkDk9mPKCkRce%2BBJYw%40mail.gmail.com.

Reply via email to