Array of variable length in struct
问题 I've created 2 structures to represent images (a pixel and an image one) in C. typedef struct pixel { unsigned char red; unsigned char green; unsigned char blue; }; typedef struct image { int width; int heigth; struct pixel pixels[width][heigth]; }; I am getting an error saying that width and heigth are not defined in the definition of image. I don't get why I'm getting that error and how I can solve it 回答1: i would suggest an alternative like this: typedef struct { int width; int heigth;