1
0
Fork 0
mirror of https://gitlab.com/mfocko/CodeWars.git synced 2024-11-24 17:51:56 +01:00
CodeWars/5kyu/i32_to_ipv4/solution.c

7 lines
192 B
C
Raw Permalink Normal View History

#include <inttypes.h>
#include <stdio.h>
void uint32_to_ip(uint32_t ip, char *output) {
sprintf(output, "%d.%d.%d.%d", (ip >> 24) & 0xFF, (ip >> 16) & 0xFF, (ip >> 8) & 0xFF, ip & 0xFF);
}