TIP: Click on subject to list as thread! ANSI
echo: c_echo
to: BRUCE WEDDING
from: KURT KUZBA
date: 1998-05-13 06:41:00
subject: i got another simple

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)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.