C is like chinese to me but i got to work with some code
struct Message {
unsigned char state;
};
char state [4][4] = { "OFF", "ON", "IL1", "IL2" };
This is a simple server that receives a message. The Struct part of it is obvious, but then theres that char array thing. Does this say theres 4 different char arrays, each containing 4 chars? What exactly is going on here? I know this sounds stupid but I cant figure it out.
It means that
stateis an array of 4 char arrays, each of them is an array of 4 char, and they are initialized with the values “OFF\0”, “ON\0”, “IL1\0” and “IL2\0”