Zombie Lyle said:Is a pointer always 4 bytes for an int, char or float?
Also guys, I hate to ask loads of questions but I'm useless at C++. I don't know how to use a vector as an array. The question is below.
Write the C++ code to dynamically create a vector of 100 long integers. Explain how you could use this block of memory as a two dimensional array of 10 by 10 long integers. Also give the code to release the vector.
Well, a pointer is just an address, so a pointer is typically always the same size on a given system, except for things like "far" pointers on some embedded architectures, but don't worry about that.
If a pointer to an int is 4 bytes, so is a pointer to a char. And if a pointer to an int is 8 bytes, then a pointer to a char is as well.