I want to return an array from a function. But I get the follow error :
In function 'int getRGB()':
error: invalid conversion from 'int*' to 'int' In function 'void loop()':
Writing : int getRGB()[3] doesn't seem to work :
error: 'getRGB' declared as function returning an array In function 'int getRGB()':
I searched in the forum but couldn't find a syntax for it.
Code example :
int colorsRGB[3];
int colors_1[3];
int colors_2[3];
int getRGB()
{ colorsRGB[0]=255;
colorsRGB[1]=0;
colorsRGB[2]=0;
return colorsRGB;
}
colors_1=getRGB();
colors_2=getRGB();