In the C, syntax of flexible array member like this:
struct s
{
int n;
double d[]; // flexible array member
};
And, Zero size array illegal in C.
If I declare array like this:
struct s
{
double d[0]; // Zero size array
};
GCC give warning:
warning: ISO C forbids zero-size array 'd' [-Wpedantic]
So, I'm going to my main question.
I saw following code here.
struct squashfs_xattr_entry {
__le16 type;
__le16 size;
char data[0];
};
In C zero-size array illegal.
Then,
- What is the purpose of this
data[0]
declaration in struct? - What does
data[0]
do here?