Re: copy an array?


[ Follow Ups ] [ Post Followup ] [ CS2604 Discussion WWWBoard ] [ FAQ ]

Posted by hussein on July 31, 1999 at 17:38:12:

In Reply to: copy an array? posted by MtBiker on July 31, 1999 at 17:28:20:

: OK, let's say we have 2 integer arrays declared as such:
: int *tmpArray;
: int *arrayN;

: This isn't QUITE the same way I'm trying this but lets say you try this:
: tmpArray = arrayN;

: This statement doesn' take a copy of arrayN and put it in tmpArray. If I change tmpArray, it changes arrayN.

: Now how would I make it put a COPY of arrayN in tmpArray?

something like ...
memcpy (tmpArray, arrayN, sizeof (int)*N)

check the help on memcpy ...

---

hussein


Follow Ups:



Post a Followup

Name:
E-Mail:

Subject:

Comments:

Optional Link URL:
Link Title:
Optional Image URL:


[ Follow Ups ] [ Post Followup ] [ CS2604 Discussion WWWBoard ] [ FAQ ]