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

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,900 questions

51,831 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

*/

 



answered Jul 9, 2024 by avibootz

Related questions

1 answer 87 views
2 answers 83 views
83 views asked Dec 2, 2024 by avibootz
1 answer 84 views
1 answer 72 views
72 views asked Jan 3, 2025 by avibootz
2 answers 92 views
2 answers 240 views
...