Can we have a struct element of type Variable length array? [duplicate]

If coding in C99 or C11, you might want to use flexible array members (you don’t give an explicit dimension, but you should have a convention about it at runtime in your head). typedef struct { unsigned No_Of_Employees; char* Employee_Names[]; // conventionally with No_of_Employees slots }st_employees; As for any array, each slot of a flexible … Read more

What’s the point of VLA anyway?

For reasons that are not entirely clear to me, almost every time the topic of C99 VLA pops up in a discussion, people start talking predominantly about the possibility of declaring run-time-sized arrays as local objects (i.e. creating them “on the stack”). This is rather surprising and misleading, since this facet of VLA functionality – … Read more