#include #include #include char* substr(const char* src, size_t start, size_t len) { while (start && *src) { ++start; ++src; } char* dst = malloc(len+1); if (!dst) return NULL; dst[len] = 0; return strncpy(dst, src, len); } int main() { const char* s = "\x90"; char* first = substr(s, 0, 1); printf("%02X\n", first); free(first); return 0; } #### $ gcc -Wall -Wextra -pedantic -std=c99 a.c -o a && a a.c: In function ‘main’: a.c:22:4: warning: format ‘%X’ expects argument of type ‘unsigned int’, but argument 2 has type ‘char *’ [-Wformat=] printf("%02X\n", first); ^ 1E25970