1
0
Fork 0
mirror of https://gitlab.com/mfocko/CodeWars.git synced 2024-11-22 16:43:46 +01:00
CodeWars/5kyu/convert_a_hex_string_to_rgb/solution.c

14 lines
211 B
C
Raw 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;
}