В до-C99 эпоху для struct hack использовали либо data[1] и учётом размера в malloc либо, если расширение компилятора позволяло, то использовалось data[0]. C99 позволил data[] (incomplete array, в конце структуры - flexible array member), но не позволил стаическую инициализацию такого массива
#include "stdio.h"
struct TFONT {
unsigned char N;
unsigned char W,H;
unsigned char data[];
};
struct TFONT tf1 = { 10, 8, 1, { 1, 2, 3, 4} };
struct TFONT tf2 = { 4, 2, 7, { 1, 2} };
6.7.2.1 Structure and union specifiers ... 17 EXAMPLE Assuming that all array members are aligned the same, after the declarations: struct s { int n; double d[]; }; struct ss { int n; double d[1]; }; ... 20 ... struct ss tt = { 1, { 4.2 } }; // valid struct s t3 = { 1, { 4.2 } }; // invalid: there is nothing for the 4.2 to initializeт.е. такую структру можно пустить только под malloc gcc в порядке доброй воли позволяет статическую инициализацию, но с ключиком --pedantic ворчит
~$ gcc -O2 -s -std=c99 --pedantic incompl.c incompl.c:9: warning: initialization of a flexible array member incompl.c:9: warning: (near initialization for ‘tf1.data’) incompl.c:11: warning: initialization of a flexible array member incompl.c:11: warning: (near initialization for ‘tf2.data’)