1
0
Fork 0
mirror of https://gitlab.com/mfocko/CodeWars.git synced 2024-11-25 02:01:56 +01:00
CodeWars/5kyu/convert_a_hex_string_to_rgb/solution.c

14 lines
211 B
C
Raw Permalink Normal View History

#include <stdio.h>
typedef struct {
int r, g, b;
} rgb;
rgb hex_str_to_rgb(const char *hex_str) {
rgb result;
sscanf(hex_str, "#%2x%2x%2x", &result.r, &result.g, &result.b);
return result;
}