answersLogoWhite

0

AllQ&AStudy Guides
Best answer

A byte order mark is a character indicating the endianness (byte order) of a string of text.

This answer is:
Related answers

A byte order mark is a character indicating the endianness (byte order) of a string of text.

View page

Most text encodings are supersets of 7-bit ascii, so in short yes, valid ascii is also UTF8/16, lantin-1 and most other western text encodings, but ascii is most valuable as a data-encoding because it is independent of the endianness of the computer - it takes less space to store most data in binary, but the bit patterns for the same data will vary from computer to computer, making the data less portable

View page

Endianness relates to the order of bytes in a multi-byte value. Humans prefer to work with big-endian notation, such that the value 123 is interpreted as being one-hundred-and-twenty-three. In little-endian notion, 123 would be interpreted as being three-hundred-and-twenty-one. In other words, the significance of the digit positions is completely reversed. With big-endian notation, the most significant digit always comes first. With little-endian notation, the least-significant digit comes first.

Note that although the word 'end' usually means final or last, the term derives from Jonathan Swift's novel, Gulliver's Travels, where a civil war breaks out over which end of a soft-boiled egg to crack first; the big end or the little end, analogous to the most-significant or least-significant end of a multi-digit value respectively.

View page

There are n no. of ways for determining endianness of your machine. Here is one quick way of doing the same.#include <stdio.h>

int main()

{

unsigned int i = 1;

char *c = (char*)&i;

if (*c)

printf("Little endian");

else

printf("Big endian");

getchar();

return 0;

}

In the above program, a character pointer c is pointing to an integer i. Since size of character is 1 byte when the character pointer is de-referenced it will contain only first byte of integer. If machine is little endian then *c will be 1 (because last byte is stored first) and if machine is big endian then *c will be 0.

View page
Answer

quite a low level view required ......everything stored in memmory is in form of bits (i.e. a sequence of 01). It dependes upon how you are going to read a value. Same sequence of bits can give you different values..try printing x=10; printf("%c %d",x,x);


AnswerThis is the same problem as getting the previous value of a regular variable. For example:
int x = 5;
x = 2;

How do you get the previous value of x (5)? If you didn't store the value in another variable before overwriting it with 2, then you can't. The old value is overwritten and cannot be recovered. In a union, it's possible that you might overwrite only part of a previous value if you store a value to a smaller data type. For example:
union { long a; short b; } c;
c.a = 5;
c.b = 2;

It's possible that you can recover some of the old data of c.a, but for most practical purposes that value would be garbage (and it really depends on the exact alignment of the variables and byte endianness).

View page
Featured study guide
📓
See all Study Guides
✍️
Create a Study Guide
Search results