Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- typedef struct {
- int x, y;
- char name[30];
- } Entity;
- typedef struct {
- int num;
- Entity data[];
- } flexArrayStruct;
- void func() {
- /* Space is allocated for the struct */
- flexArrayStruct *structP= (flexArrayStruct *)malloc(sizeof(flexArrayStruct) + sizeof(Entity));
- structP->num = 1;
- }
- int main(void) {
- func();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement