I am bit confuse on the implementation of reverse function.How is it reverse the code.I mean When I pass 1485. I was expecting 5841. But I know it is not the case with above code. it accept char pointer and access up to int
If you print tmp you will print it as if it was a C string, which is not the case. tmp might contain characters that can't be displayed properly and there might not be a null character to mark the end of the string.
hexadecimal has nothing to do with it. Data is stored as binary bits. Hex is simply a way of grouping those bits for easier representation.
The reverse function above works by reversing the order of some number of bytes (up to a limit of 24). How many bytes you reverse (and whether you need to at all), depends on the number representation on the source and target platforms.
Thanks a lot for sharing information.I admit my ignorance about number.
Have u seen any scenario where we need to reverse byte before write operation?.I could not find any purpose to reverse some byte before writing into file.