I'm trying to initialize both an array and the structs that it contains
#include <stdio.h>
#include <math.h>
typedef struct
{
int rgbtBlue;
int rgbtGreen;
int rgbtRed;
} __attribute__((__packed__))
RGBTRIPLE;
void edges(int height, int width, RGBTRIPLE image[height][width]);
int main()
{
int height = 3;
int width = 3;
RGBTRIPLE image[height][width] = {
{{0, 10, 25}, {0, 10, 30}, {40, 60, 80}},
{{20, 30, 90}, {30, 40, 100}, {80, 70, 90}},
{{20, 20, 40}, {30, 10, 30}, {50, 40, 10}}
};
return 0;
}
I'm not sure whether this initialization can happen at the same time or if I must initialize first all the structs before inserting them into the array.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…