Your program is correct. But the explanation at the end is confusing. The pointer doesn't store the value. It only stores the address of the value. In a 32 bit system, address is 4 Bytes. That is why we use always "int" to store pointer. Because it is also 4 bytes. However, when you store address of your data in a character byte, you get one byte of address.
In Little Endian, the least significant bit will also have the smallest address. In BE, when drawing memory as a strip with lower addresses on the left, the bits will be written in the same order as they will be written in math.
can you please make a video on how decimal(float,double) value get stored?I mean i want to how much bits/bytes is been assigned for digit before decimal and how much is assigned for the digit after decimal.It will be really grateful.
Good bro. Yes that was an architecture philosophy: "Endianess". First UNIX OS when installed on a different endianess CPU it has been shown: NUXI. that is NUXI Problem. so a conversion to Network order is required before transferring data on network. NBO Network Byte Order. which is in Big Endian. so if the CPU is Big Endian then transfer data and don't convert otherwise is in L.E then convert first then transfer.
Nice video. Too bad your example integer value wasn't 0x76543210 though, as it would have made it easier to relate the lower-order bytes to the lower-order memory addresses (and vice versa). Those are derived from the novel *Gulliver's Travels* by the way, but you're correct about it having to do with which end of a (boiled) egg is broken (ie; big end vs little end). The characters in the novel who break eggs on the little end lived in one island nation (Lilliput), but others who broke a boiled egg on the big end lived on a different island (Blefuscu). I'm not sure where people lived if they broke boiled eggs in the middle...
In all honesty, I never read the novel. When I was in Computer Science school and we got into Endianness, I did go an read the parts of the book applicable to the concepts of Little and Big Endian--but overall I think the book is a bit strange. LOL...
thanks a lot .... your videos are awesome ... keep going on more c++ related videos ...... suggestion u can create separate playlist for c++ 11 c++14 features ...........
For LE data has stored in reverse order , what about BIT order: Ex : we want store 01 -> in BE 0000 0001 at ram staring position, similarly in LE also 0000 0001 like this at back end in ram..
I think computer stores in form of binary and you using hexadecimal in example can just confuse someone like after watching your video for a minute I was thinking that 1byte=2digits 4byte=8digits then why limit for integer is 2^32 , after a minute of thinking I got that you should have taught by storing number binary instead it could have avoided these small confusions
How does machine/compiler reads character in the case of big endian, you elborated about the little endian that how compiler reads the bits.. But Pls tell me how bits are read in the case of big endian??
Saurabh, int a=0 is false, because if you will compare it like if(a==false) then it will be false because a is holding zero. But in another case char a='0', as you said it's ascii is 48 then it wont work here, i mean if you will write something like this if(a==false) then compiler will replace this code like if(48==false) and answer for this would be not true.
15sec in "First of all it spelled Endian not Indian." Me who found this video using Indian. That's why i had hard time look it up. Thanks from the informative video.
If there is some data of some Data Type and we want to access that data Byte By Byte then we cast it in char *, let me know if you need more clarification.
Your program is correct. But the explanation at the end is confusing. The pointer doesn't store the value. It only stores the address of the value. In a 32 bit system, address is 4 Bytes. That is why we use always "int" to store pointer. Because it is also 4 bytes. However, when you store address of your data in a character byte, you get one byte of address.
In Little Endian, the least significant bit will also have the smallest address.
In BE, when drawing memory as a strip with lower addresses on the left, the bits will be written in the same order as they will be written in math.
Thank you. Now I understood. Character pointer typecast!
How deeply computer scientists have worked on this....Awesome
thank you sir, nice approach to solve this problem,
Thank you sir with exact code !
Glad it helped
can you please make a video on how decimal(float,double) value get stored?I mean i want to how much bits/bytes is been assigned for digit before decimal and how much is assigned for the digit after decimal.It will be really grateful.
Good bro. Yes that was an architecture philosophy: "Endianess". First UNIX OS when installed on a different endianess CPU it has been shown: NUXI. that is NUXI Problem. so a conversion to Network order is required before transferring data on network. NBO Network Byte Order. which is in Big Endian. so if the CPU is Big Endian then transfer data and don't convert otherwise is in L.E then convert first then transfer.
Nice video. Too bad your example integer value wasn't 0x76543210 though, as it would have made it easier to relate the lower-order bytes to the lower-order memory addresses (and vice versa).
Those are derived from the novel *Gulliver's Travels* by the way, but you're correct about it having to do with which end of a (boiled) egg is broken (ie; big end vs little end). The characters in the novel who break eggs on the little end lived in one island nation (Lilliput), but others who broke a boiled egg on the big end lived on a different island (Blefuscu). I'm not sure where people lived if they broke boiled eggs in the middle...
+Tom B Waooo you reminded this story again, and when i heard this first time i also thought same thing as you did about middle once :D.
In all honesty, I never read the novel. When I was in Computer Science school and we got into Endianness, I did go an read the parts of the book applicable to the concepts of Little and Big Endian--but overall I think the book is a bit strange. LOL...
thanks a lot .... your videos are awesome ... keep going on more c++ related videos ...... suggestion u can create separate playlist for c++ 11 c++14 features ...........
+Ganesh IITR-CSE Thanks for your feedback dude.
These playlist are my future plans.
Very nicely explained
For LE data has stored in reverse order , what about BIT order: Ex : we want store 01 -> in BE 0000 0001 at ram staring position, similarly in LE also 0000 0001 like this at back end in ram..
Thanks for the explanation.
You are welcome dude..
Very well explained
Thanks..
Nicely explained
Thanks..
I think computer stores in form of binary and you using hexadecimal in example can just confuse someone like after watching your video for a minute I was thinking that 1byte=2digits 4byte=8digits then why limit for integer is 2^32 , after a minute of thinking I got that you should have taught by storing number binary instead it could have avoided these small confusions
Exactly
Love you. Very Well Explained.
Glad it was helpful!
Very well explained and end of the vedio you drawn a little doll I love it
Thanks..
How does machine/compiler reads character in the case of big endian, you elborated about the little endian that how compiler reads the bits.. But Pls tell me how bits are read in the case of big endian??
So as you took char pointer I got one question will char a='0' is false or int a=0 is false? as ascii value is 48
my question may be illogical, but still :)
Saurabh, int a=0 is false, because if you will compare it like if(a==false) then it will be false because a is holding zero. But in another case char a='0', as you said it's ascii is 48 then it wont work here, i mean if you will write something like this if(a==false) then compiler will replace this code like if(48==false) and answer for this would be not true.
Great video! Thanks!
Thank you so much
Appreciate it!!
But char pointer takes 8 bytes. Infact every pointer is in c is 8 bytes if you are using 64 bit system.
Correct!!
The pointer itself takes 8 bytes in 64 bit system memory but it will only point to a single byte...
I am trying to print *c but it always shows a question mark,
Hi if there is difference between little Endian and big endian then why both exits
Yes both are different and both exist.
Plz watch again for better understanding.
15sec in "First of all it spelled Endian not Indian." Me who found this video using Indian. That's why i had hard time look it up. Thanks from the informative video.
Thanks..
why we wre typcasting to char* ?
If there is some data of some Data Type and we want to access that data Byte By Byte then we cast it in char *, let me know if you need more clarification.
nicely explain
Thanks..
But why such confusion was created in the first place??
If no difference between both then it's better it should be one
1byte ya 1bit plz confirm..........
thanks for the program, I'm going to use it to convert heihachis soul calibur II moveset to work on gamecube
Good explanation...bad egg drawing
Sorry for that, i have good equipment's now.
Actually its Endian not Endin
Thanks man.
🔥
big indian
Indians ko Endians bolta hai gaddaar 🤬🤬
Tum khud ka doubt clear kro pehle.
Jii bilkul