Whats SizeOf?
Whats SizeOf?
it gives you the size in memory taken up by what you pass into it.
Ex:
Code:sizeof( int ); // returns the number of bytes for an integer int array[size]; sizeof( array ); // returns the total size of the array in bytes // can be used in combination to find the size of dynamic memory int size = sizeof( pointer_to_array )/sizeof( array_type );
What determines their sizes?
A Win32 integer is 4 bytes large. 1 byte consists of 8 bits (8*4=32, that's why its called a 32bits variable).Originally posted by Drakon
What determines their sizes?
1 bit can have 2 values (1/0). This means that the integer can have 2^32 different values (which is 4294967296).
Either from 0 to 4294967296 (unsigned int) or from -2147483647 to +2147483648 (signed int, or simply int).
A double integer (double) is a 64bit variable, and has therefore 2^64 different values (which is 18446744073709551616, wheee!!! alot more).
So, the thing that determines the size of a variable is the amount of bytes that it uses.
As you can see, if you double the amount of bytes doesn't mean doubling the maximum number you can store in it .
MagosX.com
Give a man a fish and you feed him for a day.
Teach a man to fish and you feed him for a lifetime.
base types [variable declaration keywords and their modifiers] depend on the compiler... conglomerate types [structs/unions/arrays/etc] are constructs of those respective and possibly modified base types... the use of sizeof keyword can help make your program more portable at compile and run time... it can vary in the OS as well...
hasafraggin shizigishin oppashigger...
>> hasafraggin shizigishin oppashigger...
What does this mean???
I've been wondering this for a looong time...
MagosX.com
Give a man a fish and you feed him for a day.
Teach a man to fish and you feed him for a lifetime.
i made a post about it in the gen disc... [intuitively titled 'hasafraggin shizigishin oppashigger'] a long time ago... search and ye shall find...
hasafraggin shizigishin oppashigger...
Ok, found it
http://www.cprogramming.com/cboard/s...in+oppashigger
Hey, can you say that sentence 10 times in a row?
MagosX.com
Give a man a fish and you feed him for a day.
Teach a man to fish and you feed him for a lifetime.