C++ signed Keyword
Example
Create a signed integer that stores a negative number:
signed int myNum = -500;
cout << myNum;
Definition and Usage
The signed keyword specifies that an int or char can store both positive and negative values.
This is already the default for int, so signed int and int mean the same thing. That is why the keyword is not used very often. For char, it depends on the compiler if it can store negative values, so write signed char if you need to be sure.
Related Pages
The unsigned keyword does the opposite. It only allows positive values, so an int can store larger positive numbers.
Read more about data types in our C++ Data Types Tutorial.