c - Array declaration and initialization with structs -


i trying declare array of structs, possible initialize array entries default struct value?

for example if struct

           typedef struct node            {    int data;                 struct node* next;            }node; 

is there way decalre data 4 , next null? 0 , null?

sure:

node x[4] = { {0, null}, {1, null}, {2, null}, {3, null} }; 

even should fine:

node y[4] = { {0, y + 1}, {1, y + 2}, {2, y + 3}, {3, null} }; 

Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -