Got it!! Thanks a lot for all responses.
________________________________ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of David Hamill Sent: Wednesday, October 15, 2008 4:08 PM To: [email protected] Subject: Re: [c-prog] Re: Does C++ allows array copying? Arrays can be copied but only by copying their individual elements. E.g. you can use the library function strcpy() to copy strings (arrays of char). Because of the close link between array names and pointers, assigning an array name does not copy the underlying array, but instead makes the pointer an alias for the array name: int i; int a[] = {1, 2, 3}; int *b = a; Now a[i] and b[i] refer to the same area of memory. The array values themselves have not been copied. Changing b[i] will change a[i] and vice versa, because they're the same thing. If you want to copy an array, as John Matthews suggests, you can wrap it in a struct. Structs can be copied and can even be returned by functions. Disclaimer: the above applies to C; I don't know any C++. David [Non-text portions of this message have been removed]
