devxlogo

converting a 64 bit number from little indian to big indian

#includeint INT_little_endian_TO_big_endian(int i){ return ((i&0xff)8)&&0xff000000)8)|((i24)&ff0000)|((i40)&ff00)|((i56)&ff)}int main(){int num = 1,rev; if(*(char *)&num == 1) //if num is odd,compare with 1 other wise compare with 0{ printf(”
Little-Endian
“);}else { printf(“Big-Endian
“);}rev=INT_little_endian_TO_big_endian(num);printf(“%d
“,rev);return 0;}

Charlie has over a decade of experience in website administration and technology management. As the site admin, he oversees all technical aspects of running a high-traffic online platform, ensuring optimal performance, security, and user experience.

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.