أنشئ حسابًا أو سجّل الدخول للانضمام إلى مجتمعك المهني.
// Use this code For storing data in big endian format in little endian machine , u can c0mpile & check !!!!!!!!
#include<stdio.h>void yup(char *start,int n){int i;for(i=0;i<n;i++)printf("%x",start[i]);printf("\\n");}void main(){int i=0x;printf(".......................little endian............................\\n");yup((char *)&i,sizeof(i));int b=((i>>24)&0x00ff)|((i>>8)&0xff00)|((i<<8)&0x00ff0000)|((i<<24)&0xff000000);//printf("%x\\n",b);printf("...............converted into bidendian..........................\\n");yup((char*)&b,sizeof(i));}
WITH THE HELP OF RIGHT SHIFT DATA WE CAN CONVERT DATA FIRST INTO BIG ENDIAN TO LITTLE ENDIAN .
Little and big endian are two ways of storing multibyte data-types ( int, float, etc). In little endian machines, last byte of binary representation of the multibyte data-type is stored first. On the other hand, in big endian machines, first byte of binary representation of the multibyte data-type is stored first.