#include <stdio.h> // TODO: Declare Colour structure: struct Colour { unsigned char red; unsigned char green; unsigned char blue; }; // TODO: Declare functions: //struct Colour create_colour(... struct Colour create_colour(unsigned char red, unsigned char green, unsigned char blue); //void print_colour(... void print_colour(struct Colour a_colour); int main(void) { print_colour(create_colour(255, 0, 0)); // RED print_colour(create_colour(0, 255, 0)); // GREEN print_colour(create_colour(0, 0, 255)); // BLUE print_colour(create_colour(255, 255, 0)); // YELLOW print_colour(create_colour(255, 0, 127)); // PINK return 0; } // TODO: Define functions: struct Colour create_colour(unsigned char red, unsigned char green, unsigned char blue) { struct Colour colour; colour.red = red; colour.green = green; colour.blue = blue; return colour; } void print_colour(struct Colour a_colour) { printf("RGB: %u, %u, %u\n",a_colour.red,a_colour.green,a_colour.blue); }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter