So in my exam in the class I was supposed to declare X as a short unsigned. I declared it short unsigned int X. Is this way still OK and correct? Thank you
Yes, short unsigned int
and short unsigned
are exactly the same type.
Personally I prefer unsigned short
for readability.
See for yourself by testing
std::is_same<short unsigned int, short unsigned>::value