What does the data type 'Unsinged' and 'Signed' ?

Hello! I was following a tutorial on YouTube from a guy called 'Thenewboston'. I finished his tutorials about a week ago and thought I knew all I needed to know about C++. But the other day I saw on the SFML website (I want to get into game development using SFML and OpenGL and C++) the were talking about signed and unsigned. What does this mean? Should 'Thenewboston' have covered it? It is a fundamental part of C++? Thanks for any help at all!
Signed variables allow for signed (negative) numbers. They do this by marking the highest bit as "negative".

Unsigned variables use all available bits for positive number representation, which means they cannot contain negative numbers, but can contain a higher maximum than their signed counter parts.

Examples... some variable types, and their minimum..maximum



                 signed                   unsigned
-----------------------------------------------------
 8-bit |        -128..127                 0..255
16-bit |      -32768..32767              0..65535
32-bit | -2147483648..2147483647       0..4294967295
Last edited on
Thanks! So a signed number is a negative number basically?
A signed number can be negative. That doesn't necessarily mean it is negative.
I know. But an unsigned cannot be a negative but a signed number has the option to be, right?
yes
Ok thanks! =)
Topic archived. No new replies allowed.