문제

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