How to iterate through Linked List

前端 未结 4 1469
挽巷
挽巷 2021-01-12 08:12

I have looked around and I can\'t really find an answer I can understand or it doesn\'t apply to me. I have this class:

class Node
{
    public int value;
           


        
4条回答
  •  暖寄归人
    2021-01-12 09:05

    Try this basic iteration:

    Node tmp = head;
    while (tmp != null)
    {
        //do your checking...
        tmp = tmp.next;
    }
    

提交回复
热议问题