I hope this sample program helps ...
#include <stdio.h> typedef struct { int a; int b[10]; }xx; typedef struct { xx x1; char b; }yy; int main() { yy zz = {{0, {1,2,3}}, 'A'}; printf("\n %d %d %d %c\n", zz.x1.a, zz.x1.b[0], zz.x1.b[1], zz.b); return 0; }
yy zz = {{0, {0}}, 'A'}; will initialize all elements of the array b [10], the value 0 will be set.
Like the @unwind clause, in C, all instantiated instances must be initialized manually. There is no constructor.
Jeyaram
source share