Topic: byte size?


Author: 6850150@LMSC5.IS.LMSC.LOCKHEED.COM
Date: Mon, 4 Apr 1994 14:59:56 GMT
Raw View
Could somebody tell me how to write a program to find the size (in bytes), on
my machine, if int, long, float, double, and char?
Thanks in advance.
Victor

ps What goes "Klop klop klop klop...BOOM, klop klop klop klop?


ans: an Amish drive-by shooting.




Author: bobzim@interaccess.com (Bob Zimmerman)
Date: 4 Apr 1994 20:47:05 GMT
Raw View
6850150@LMSC5.IS.LMSC.LOCKHEED.COM wrote:
> Could somebody tell me how to write a program to find the size (in bytes), on
> my machine, if int, long, float, double, and char?

well... if I understand you correctly... you could do something like:

void main(void)
{
   int aInt;
   double aDouble;
   cout << sizeof(aInt) << endl;
   etc....
}
Don't forget to include iostream.h

Or without a program, you can simply look into limits.h with has these
limits as consts for the environment your in (probably more what you are
looking for)

--
---------------------------------------------------
| Bob Zimmerman   bobzim@interaccess.com          |
|        Voice:   (708) 402-4664                  |
|                                                 |
| If it's worth reading,                          |
|             you found it on Internet!           |
---------------------------------------------------




Author: lincmad@netcom.com (Linc Madison)
Date: Tue, 5 Apr 1994 01:08:54 GMT
Raw View
6850150@LMSC5.IS.LMSC.LOCKHEED.COM wrote:
: Could somebody tell me how to write a program to find the size (in bytes), on
: my machine, if int, long, float, double, and char?

[bad joke deleted]

Your server must be a little slow; your question didn't get posted until
April FOURTH.  If by chance you're serious, I'll just say 4 words: "C++
book," "sizeof" and "cout."

-- Linc Madison   *   Oakland, California   *   LincMad@Netcom.com