1. ## RAM question

How much RAM does it take for every integer? What about a char or char[256]? I haven't been able to find any decent tutorials on objects (i guess i can initialize one but i cant get them to interact) i have been simply declaring lots of variables, but I assume that wastes memory

2. >How much RAM does it take for every integer?
sizeof (int) bytes.

>What about a char or char[256]?
sizeof (char) bytes and sizeof (char) * 256 bytes.

>i have been simply declaring lots of variables, but I assume that wastes memory
Don't worry about it, memory is in abundance currently and I seriously doubt you'll be writing anything memory intensive soon if you had to ask this question.

3. each compiler (Operating system?) uses a different amount of memory to store any given type. Some will use 4 bytes to store an int, some 8, some 16, and maybe even some 32; who knows. Using the sizeof() operator as indicated by Prelude will let you know what your compiler/system uses.

who knows, I may even be mixing up bytes and bits. Doesn't matter. sizeof() is the key to finding out.

4. 32 byte long integers? I don't know of any processor that uses 256-bit numbers; certainly not natively.

On your run of the mill 32-bit x86 machine, compiled for MS Windows, the primitives take the following amounts of space:

char - one byte (8 bits)
short - two bytes (16 bits)
int - four bytes (32 bits)
long - four bytes (32 bits)
Pointers - four bytes (32 bits)

There are also 64 bit data types, but they aren't primitives.

It does completely depend, though, on the platform you develop on. In general, char is the size of the characters (usually 7, 8 or 9 bits), int is the size of the processor's accumulator register. Sizeof() is the foolproof way to know how much space your variable will take.

5. I'd consider a double both primative and 64 bit.

6. I don't know of any processor that uses 256-bit numbers
Absolutely, 640K will be enough memory to take us into the 21st century and beyond!

I think elad was just being rhetorical..

7. Originally posted by SilentStrike
I'd consider a double both primative and 64 bit.
Umm... d'oh? I guess I wasn't thinking about floating-point numbers.