comparison between signed and unsigned integer expressions c++ code example

Example 1: difference between unsigned and signed int c++

//Difference between unsigned and signed variable types

unsigned int x; //Can hold zero & positive numbers

signed int y; //Can hold negative, zero, and positive numbers

Example 2: difference between unsigned and signed c++

unsigned int x; //Unsigned variables can store the number zero and positive numbers.

signed int y; //Signed variables can store negative, zero, and positive numbers.

Tags:

Cpp Example