mirror of
https://gitlab.com/mfocko/CodeWars.git
synced 2024-11-22 16:43:46 +01:00
14 lines
211 B
C
14 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;
|
||
|
}
|