Can anyone tell me the upper and lower limits for the basic data types (int, float, long, etc.)?
ie. Ints have upper limits of 32000ish if I'm not mistaken, but I need the exact numbers.
Thanks a bunch...
Can anyone tell me the upper and lower limits for the basic data types (int, float, long, etc.)?
ie. Ints have upper limits of 32000ish if I'm not mistaken, but I need the exact numbers.
Thanks a bunch...
Look in limits.h
When all else fails, read the instructions.
If you're posting code, use code tags: [code] /* insert code here */ [/code]
That didn't seem to work.
I'm not terribly advanced and I have trouble reading what the libraries say.
And it also didn't look like it had all the data types I needed (if it did, they had different names)
anybody else?
"No! I must have my delicious cupcakes, my sweet cakey treasures, piping hot from their 40 watt WOMB!!!"
--Captain Murphy
Look in either <limits> or <limits.h>
Here's an example using limits:
Code:#include <iostream> #include <limits> int main(int argc, char** argv) { using namespace std; cout << "\nsigned int max: " << std::numeric_limits<signed int>::max(); cout << "\nsigned int min: " << std::numeric_limits<signed int>::min(); cout << "\nchar max: " << std::numeric_limits<char>::max(); cout << "\nchar min: " << std::numeric_limits<char>::min(); return 0; }
I'm afraid I still don't understand.
I don't want a program that produces these values.
I don't even have a copy of Visual Studio herea t home.
I just need the numbers...
"No! I must have my delicious cupcakes, my sweet cakey treasures, piping hot from their 40 watt WOMB!!!"
--Captain Murphy
>>I just need the numbers...
The numbers will be different for different machines. You have to use either <limits> or <climits>/<limits.h> for any measure of portability. If anyone gives you just the numbers and doesn't say "at least" then they're wrong. :-)
*Cela*
It's implementation dependant.
Depending on what system you're on, the size of different types vary.
edit: Beaten
For a 16 bit machine it is
unsigned int=2^16 -1 (2 to the power 16) =65535
for a 32 bit machine
unsigned int=2^32 -1 =4294967295
for signed int value divide it by two
at the moment my calculkator is not working
Last edited by nag; 01-27-2003 at 08:20 AM.