My professor mentioned that byte ordering (endianess)
is not an issue for standard C String
(Char arrays
):
for ex: char[6]="abcde";
But he did not explain why?
Any explanations for this will be helpful
A char
takes up only one byte, thats why the ordering does not matter. for example, int
has 4 bytes and these bytes could be arranged in little-endian and big-endian`.
Eg: 0x00010204
can be arranged in two ways in memory:
04 02 01 00 or 00 01 02 04
char
being a single byte will be fetched as single byte to CPU
. and String
is just a char
array.