Realize that someName is a pointer, and resultant is an array.
A pointer is a variable that contains an address. How can you assign an address to an array? Ponder on that. It should be trivial if you understand how arrays and pointers work.
Printable View
Realize that someName is a pointer, and resultant is an array.
A pointer is a variable that contains an address. How can you assign an address to an array? Ponder on that. It should be trivial if you understand how arrays and pointers work.
Thanks for pointing out the differences between pointers and array. I was taking that the transfer between the two variables for granted, assuming that the two variables were both pointers. Would the only way of transferring the contents be transferring what the pointer dereferences one by one until the pointer is pointing to a null character?
Oh yes, it would work just fine, but an array isn't a pointer, so that's where the problem lies.
Yes! Your mind is clever :)Quote:
Would the only way of transferring the contents be transferring what the pointer dereferences one by one until the pointer is pointing to a null character?
That's exactly what string copy functions do.
strcpy for char and wcscpy for wchar_t.
Thanks for the tip on the strcpy functions. They worked quite nicely.
That's what they were designed to do ;)