Computing.Net > Forums > Programming > size of int vs. pointer

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

size of int vs. pointer

Reply to Message Icon

Name: L33TRice
Date: March 13, 2008 at 03:53:25 Pacific
OS: UNIX
CPU/Ram: lots
Product: SUN
Comment:

Quick question, as far as it goes in C++, what are the sizes of (i.e. bits, or bytes) of ints, and pointers? Specifically which is larger?

Thanks.



Sponsored Link
Ads by Google

Response Number 1
Name: Razor2.3
Date: March 13, 2008 at 04:28:57 Pacific
Reply:

In C/C++...
A byte is at least 8 bits.
char is exactly 1 byte
short is at least 16 bits.
int is at least 16 bits.
long is at least 32 bits.
Also: short <= int <= long.
Finally: sizeof(int) == sizeof(unsigned int).

A pointer's size is determined by the platform, and has no guaranteed size. Therefore, my answer is, Both and neither.


0

Response Number 2
Name: Whiavi
Date: March 13, 2008 at 19:23:02 Pacific
Reply:

Good answer.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


Batch to Delete files in ... batch script to replace f...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: size of int vs. pointer

Type casting void pointers www.computing.net/answers/programming/type-casting-void-pointers/12252.html

size of a STRUCT www.computing.net/answers/programming/size-of-a-struct/9179.html

size of memory block in malloc www.computing.net/answers/programming/size-of-memory-block-in-malloc/6776.html