Skip to content

Instantly share code, notes, and snippets.

@jagannath-sahoo
Created July 24, 2019 15:50
Show Gist options
  • Save jagannath-sahoo/4d980cb98e610d69590b7409b69c0058 to your computer and use it in GitHub Desktop.
Save jagannath-sahoo/4d980cb98e610d69590b7409b69c0058 to your computer and use it in GitHub Desktop.
Format Specifier for HEX BY Abdul ki magic
#include <stdio.h>
#include <stdint.h>
char hex_string[2];
int main(void)
{
uint8_t check_sum = 242;
sprintf(hex_string, "%02X", check_sum);
for(int i=0; i<4;i++)
printf("%c\n",hex_string[i]);
printf("0: %s\n", hex_string);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment