Is there a fundamental type for natural numbers in C/C++?

Viewed 4292

I have a problem in which I need to declare some variables as natural numbers. Which is the propper fundamental type that I should use for variables that should be natural numbers ? Like for integers is int ...

4 Answers

There's not any particular data type representing natural numbers. But you can use data types for whole numbers and then make some appropriate edits. Here are a few ways to declare whole numbers:

 - unsigned short int

 - unsigned int

 - unsigned long int

 - unsigned long long int
Related