Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!abvax!iccgcc!browns From: browns@iccgcc.decnet.ab.com (Stan Brown) Newsgroups: comp.lang.c Subject: Re: Arrays and stuff Message-ID: <3293.27bbfc4b@iccgcc.decnet.ab.com> Date: 15 Feb 91 20:20:43 GMT References: <26915@uflorida.cis.ufl.EDU> Lines: 29 In article <26915@uflorida.cis.ufl.EDU>, jdb@reef.cis.ufl.edu (Brian K. W. Hook) writes: > Basically, you can initialize an array with values, and you can't > re-initialize after declaration. However, if I wanted to put a string into > an array I could use strcpy(), but I want to fill in the entire array with > a predefined array: in effect: > char array[NUMBER][SIZE]; > array[number]={ ...assorted values...}; > How do I do this? I want different bitmasks for a cursor depending on what > the user does, but I can't seem to implement this very easily unless > I use: > char *mask; > mask=&array[0][0]; > or > strcpy(mask,array[0]); > But this is a pain for certain things that I am doing. And I DEFINITELY > don't want to do: > array[0][0]=0x44; > array[0][1]=0x99; > etc. etc. Use memcpy not strcpy: memcpy(array[n], mask, SIZE); will copy SIZE bytes from mask to array[n]. memcpy is declared in Hey--this is all my opinion, nobody else's. Rely on it at your peril. "no yucky green things" email: browns@iccgcc.decnet.ab.com Stan Brown, Oak Road Systems, Cleveland, Ohio, USA +1 216 371 0043