Is char signed or unsigned by default?

The book is wrong. The standard does not specify if plain char is signed or unsigned. In fact, the standard defines three distinct types: char, signed char, and unsigned char. If you #include <limits.h> and then look at CHAR_MIN, you can find out if plain char is signed or unsigned (if CHAR_MIN is less than … Read more

Signed versus Unsigned Integers

Unsigned can hold a larger positive value and no negative value. Yes. Unsigned uses the leading bit as a part of the value, while the signed version uses the left-most-bit to identify if the number is positive or negative. There are different ways of representing signed integers. The easiest to visualise is to use the … Read more

Iteration over std::vector: unsigned vs signed index variable

For iterating backwards see this answer. Iterating forwards is almost identical. Just change the iterators / swap decrement by increment. You should prefer iterators. Some people tell you to use std::size_t as the index variable type. However, that is not portable. Always use the size_type typedef of the container (While you could get away with … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)