I've tried something similar previously.
typedef struct pixel {
int r;
int g;
int b;
} pixel_t;
#define PIXEL(red, green, blue) \
(pixel_t) \
{ \
.r = (red), \
.g = (green), \
.b = (blue)
}
Then I could invoke the function void display_pixel(pixel_t pixel);
by calling, display_pixel(PIXEL(255, 255, 255));
And you could even, return PIXEL(255, 255, 255);
Like magic. In other words, how do you pretend that you have syntax-level OOP in C... On retrospect, the macro could reduce readability, writing the argument explicitly may be better. display_pixel((pixel_t) {.r = 255, .g = 255, .b = 255});