Question

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?

Était-ce utile?

La solution

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

or simply :

struct image streams[NR_STREAMS][NR_FRAMES]
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top