Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Instant Grammar Checker - Correct all grammar errors and enhance your writing

Semrush - keyword research tool

Prodentim Probiotics Specially Designed For The Health Of Your Teeth And Gums

Teach Your Child To Read

Disclosure: My content contains affiliate links.

31,648 questions

41,701 answers

573 users

How to print hex value in chunks using char* with C

1 Answer

0 votes
#include <stdio.h>
#include <stdint.h> 

int main(void)
{
    uint32_t hex = 0x01020304;
    char* p = (char*)&hex;

    // Intel: little-endian  
    printf("%x %x %x %x\n", p[0], p[1], p[2], p[3]);

    return 0;
}



/*
run:

4 3 2 1

*/

 



Learn & Practice Python
with the most comprehensive set of 13 hands-on online Python courses
Start now


answered Jul 9 by avibootz

Related questions

2 answers 127 views
1 answer 35 views
1 answer 27 views
...