This is a nice write-up with good small examples.
You say that the array on line 3 cannot be changed but I don't believe the array in Line 1 can be either, right?
Also, it would be nice to know the length of the final strings and/or arrays.
For example you state at the beginning that a string is a 1 dimensional array of characters terminated by \0. Is the terminating character included in the length of the string?
Is the length of str[] 4 or 5? It'll be 4, right? Doesn't include \0.
thanks
The first and the third way are the same except one is easier to type. So the comment for the third is also valid for the first.
And yes, it will not include '\0' in length. It reduces the length by 1 but it is still there.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
This is a nice write-up with good small examples.
You say that the array on line 3 cannot be changed but I don't believe the array in Line 1 can be either, right?
Also, it would be nice to know the length of the final strings and/or arrays.
For example you state at the beginning that a string is a 1 dimensional array of characters terminated by \0. Is the terminating character included in the length of the string?
Is the length of str[] 4 or 5? It'll be 4, right? Doesn't include \0.
thanks
The first and the third way are the same except one is easier to type. So the comment for the third is also valid for the first.
And yes, it will not include '\0' in length. It reduces the length by 1 but it is still there.