How do you initialize a struct?
Likewise, how do you initialize a struct to NULL?
You can't. NULL is a pointer whose value is set to zero, but your mark and space properties are not pointer values. In your code as you have it, they will both be value types, allocated as part of your Pair struct. Change the variables to Segment * instead of Segment , and you will be able to set them to NULL.
Similarly, it is asked, how is an array of structure initialized?
As soon as after declaration of structure we initialize structure with the pre-defined values. For each structure variable we specify set of values in curly braces. Suppose we have 3 Array Elements then we have to initialize each array element individually and all individual sets are combined to form single set.
If a structure variable is partially initialized, all the uninitialized structure members are implicitly initialized to zero no matter what the storage class of the structure variable is.