flexible-array-member-test.c revision a4e54154
1#include <stdlib.h> 2#include <stdio.h> 3#include <stddef.h> 4 5struct s { int n; double d[]; }; 6 7int main(void) 8{ 9 int m = getchar (); 10 struct s *p = malloc (offsetof (struct s, d) 11 + m * sizeof (double)); 12 p->d[0] = 0.0; 13 return p->d != (double *) NULL; 14} 15