I'm just learning C, and I'm having problems with assigning an array to a property (pulses
).
I have a struct:
typedef struct irPulseSet
{
int pulseCount;
int pulses[][2];
} irPulseSet;
I create a new variable with the irPulseSet
type that I created above, and define an array:
irPulseSet upButton;
upButton.pulseCount = 31;
int upButtonPulses[31][2] =
{
{ 0 , 120 },
{ 440 , 360 },
{ 440 , 340 },
{ 440 , 1120 },
{ 420 , 380 },
{ 420 , 360 },
{ 400 , 1140 },
{ 420 , 1120 },
{ 420 , 380 },
{ 420 , 1140 },
{ 420 , 1120 },
{ 440 , 340 },
{ 440 , 360 },
{ 440 , 1120 },
{ 440 , 1120 },
{ 420 , 1120 },
{ 400 , 1140 },
{ 420 , 360 },
{ 440 , 340 },
{ 440 , 360 },
{ 440 , 1140 },
{ 440 , 360 },
{ 440 , 340 },
{ 440 , 380 },
{ 420 , 360 },
{ 440 , 1120 },
{ 440 , 1120 },
{ 440 , 1120 },
{ 440 , 27400 },
{ 7160 , 1500 },
{ 0 , 0 }
};
I then assign that array to a property in the irPulseSet
struct.
upButton.pulses = upButtonPulses;
But when I compile, I get the error:
invalid use of flexible array member
What am I doing wrong here?