what is the difference between signed and unsigned integer code example

Example 1: difference between unsigned and signed

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.

Example 2: 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

Tags:

C Example