so i have two char array
and basically i want to do this:
if i set it to string then works but why doesn't it work for char array?
You may want to read a little more on this: http://cplusplus.com/doc/tutorial/ntcs/
with character arrays, things like:
char message = "arts";
are completely valid, but only if you are doing this in the initialization, and only if you are initializing it the moment it is being declared.
After that, assignments such as:
Unless you have a pretty good grasp on arrays and pointers, you're probably better off sticking with strings for now.
Last edited on
Thanks for the replay. I have to do this in char. Can anyone give me an example on how i would go about doing this.
strcpy and related functions.
In C/C++ there is no assignment operator for arrays. You have to use some sort of coping that to assign one array to another.
Topic archived. No new replies allowed.