Grant Robinson wrote:
It depends on what you mean by "character array". If you are talking about a variable declared like so:char myarray[32]; Then to get the address, you would do the following: print("The address is %p\n", (&myarray)); If you are talking about a variable declared like: char *myarray = new char[32];Then the address is stored in 'myarray', and de-referencing 'myarray' will give you the actual contents of the string.
Wrong. In both cases (char* and char[]), the variable itself stores the address. You do not need the & operator in either case.
In fact, using the & operator is incorrect, because it will give you the address of the variable that was already holding the address of the character array, instead of the address of the character array.
--Dave /* PLUG: http://plug.org, #utah on irc.freenode.net Unsubscribe: http://plug.org/mailman/options/plug Don't fear the penguin. */
