I defined a data structure as follows:

struct image{
unsigned int width, height;
unsigned char *data;
};

An array of structures as defined above would be something like:

struct image input[NR_FRAMES];

If I would like another array, let's say streams, that has as elements streams[i] arrays of structures as defined above, how would I declare it?

有帮助吗?

解决方案

typedef struct image Stream[NR_FRAMES];
Stream streams[NR_STREAMS];

or simply :

struct image streams[NR_STREAMS][NR_FRAMES]
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top