Is there a way in C for the next node in a linked list be NULL by default?

42 Views Asked by At

Is there a way in c for us to create a linked list struct where the next node value be NUll by default like in java we can do

class Node{
  int data;
  Node next
  Node(int d){
    data=d;
    next=NULL;
  }
}

here the next value is by default initialised to NULL is there any way to do this in c.

i dont want to do it in the main function so that code for creating a linked list will be smaller

0

There are 0 best solutions below