1
0
Fork 0
mirror of https://gitlab.com/mfocko/CodeWars.git synced 2024-09-18 21:56:57 +02:00
CodeWars/5kyu/convert_a_hex_string_to_rgb/solution.c
Matej Focko fc899b0b02
chore: initial commit
Signed-off-by: Matej Focko <mfocko@redhat.com>
2021-12-28 16:19:58 +01:00

13 lines
211 B
C

#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;
}