Re: C++ array length
In this example you're using C arrays. C arrays are nothing more than a chunk of contiguous memory, and that memory must be allocated to your program. You have specify how much memory you want, ie how long you want your array to be. if you're used to something like python with dynamically resizing lists, that uses some dynamic allocation which is probably above your level right now. If you want to look into it more, google malloc.
If you want a container that is very similar to a C array, but which automatically resizes itself when necessary, look into std::vector.
EDIT: also, your two examples are NOT the same. The first makes a char array (as in, both the pointer and the memory it's pointing to) on the stack which is initialized to that string, whereas the second makes a char pointer on the stack, which points to a readonly part of memory that contains the string you specify. (2nd edit, I was confusing char *string and char string, see edit in post #4)
Last edited by schauerlich; July 11th, 2010 at 02:56 AM.
Posting code? Use the [code] or [php] tags.
I don't care, I'm still free. You can't take the sky from me.