BW> I challenge you to increment an array name.
An array name, of course, cannot be incremented.
If, however, one uses a pointer to the array, then that
pointer may be incremented. Similarly, if one takes the
reference to incrementation as meaning incrementing the
index for the array name, then it is similarly simple.
#include
int main(void)
{
char textarray[13] = "", word[13] = "Hello World!";
char *w = textarray;
int index;
for(index = 0; index < 12; index++, w++)
w = word[index];
puts(textarray);
return 0;
}
It is unlikely, however, as you say, that you will be
incrementing either word or textarray in this example,
as they are only valid LValues upon initialization.
Notice how I used the standard initialization of all
elements to 0 unless otherwise specified where an
initialization is specified in the creation of
textarray and then skipped adding a nul terminator to
the array in the copy sequence, just to invite argument
that my textarray string is not properly terminated.
---
> ] It's around somewhere. I put it where I wouldn't lose it....
---
---------------
* Origin: *YOPS ]I[* 8.4 GIG * RA/FD/FE * Milwaukee, WI (1:154/750)
|