I need to declare an array that consists of different variable types, mainly:
char *A; uint32_t B; int C;
As I understood in the tutorials, in the array you declare the type and the number of element. So to say something like:
int a[3];
where in this case, the type of the three elements are all integers.
So how do I want to declare an array that consists of the three different types mentioned above?
The definition of an array in C is a collection of elements of the SAME type. What you are looking for is probably a
struct.Or, as mentioned in a comment below, you could use a
unioninstead. But then you can’t use A, B, and C at the same time like I have in the example above – only one of them will be stored – in my example it would be C.You can make an array of structures if you need to.