Let''s say I have two char arrays:
char originalArray[256];
char copyArray[256];
Let''s say that I want to make the copyArray equal to the originalArray. The thing is I don''t want to use strcpy() because I want changes in the originalArray to be reflected in the copyArray.
I realize that I could make copyArray a pointer to the originalArray and do this:
char originalArray[256];
char* copyArray[256];
copyArray = &originalArray
But other parts of my code depend on the copyArray being a regular array, and not a copy to an array (since in certain areas, I want to simply do a strcpy to it).
My question is this. I know this doesn''t work, but could someone explain to me why:
char originalArray[256];
char copyArray[256];
copyArray = originalArray;
I figure that this should make the copyArray (or the address of the first element in it) equal to the first element of the original array.
I apologize for this, since I expect the answer is rather basic, but we never covered it in any of my classes, or any of the books I''ve gone over.
--Vic--