I was reading some assembly tutorial in which there were explained the signed integers and the unsigned integers and the difference between their representation in computer memory.

I remember something like that there was some bit at the beginning at the number so it tells whether the integer is unsigned or signed.

If someone knows it, please answer.

Wikipedia's page on Signed Number representation shows the most common memory implementations of both signed and unsigned integer values.

Two's complement is the most common representation.

There are many possible representations of signed numbers, the most common is two's complement.

The MSB does not determine whether or not the number is signed; in signed numbers it represents whether the number is negative. In unsigned numbers it's just the MSB. It's the program that determines whether a number is considered signed or unsigned.

he he. tricky question. signed and unsigned integers are represented exactly same. looking at memory you will never be able to distinguish them. it comes out of one of Von Neumann's principle. So where is difference? Difference is in the way they are interpreted. If variable is signed compiler uses commands for signed ints. Also if we know that number is signed it's first bit tells us it's sign. the conversion is done as `~i + 1`

(c syntax) in both ways

There are many possible representations, each one depending on your computer's organization. The most famous are

On both representations, you can test the first (most significant) bit to find out whether the number is positive (usually off) or negative (bit on). That is, if you treat the number as **signed**. If you tell the compiler to treat such numbers as unsigned, the sign bit is used as data (which doubles the maximum range for the data type).