cpp-cheat/gcc/zero_length_array.c
2016-05-18 10:21:52 +02:00

28 lines
453 B
C

/*
# Zero length arrays
http://stackoverflow.com/questions/9722632/what-happens-if-i-define-a-0-size-array-in-c-c
Major application looks like pre-99 flexible array member:
struct S {
int is[0];
};
to save a byte compared to:
struct S {
int is[1];
};
*/
#include "common.h"
int main(void) {
int is[0];
int i;
printf("&is[0] = %p\n", &is[0]);
printf("&i = %p\n", &i);
return EXIT_SUCCESS;
}