It sounds like you expected a deep copy.

The copy method does a shallow copy, that is it just makes a copy of the array and not of the items in the array.

So when you do [self.cleanEditContents copy] the new array shares exactly the same items as the original.

If you need a deep copy (or maybe just a 2-level copy) you need to code it yourself.

Supposedly separate NSArray being contaminated by editing a copy
everyone. I actually have two questions, somewhat related.

Question #1: Why is gcc letting me declare variables after action statements? I thought the C89 standard did not allow this. (GCC Version: 4.4.3) It even happens when I explicitly use --std=c89 on the compile line. I know that most compilers implement things that are non-standard, i.e. C compilers allowing // comments, when the standard does not specify that. I'd like to learn just the standard, so that if I ever need to use just the standard, I don't snag on things like this.

Question #2: How do you cope without objects in C? I program as a hobby, and I have not yet used a language that does not have Objects (a.k.a. OO concepts?) -- I already know some C++, and I'd like to learn how to use C on it's own. Supposedly, one way is to make a POD struct and make functions similar to StructName_constructor(), StructName_doSomething(), etc. and pass the struct instance to each function - is this the 'proper' way, or am I totally off?

EDIT: Due to some minor confusion, I am defining what my second question is more clearly: I am not asking How do I use Objects in C? I am asking How do you manage without objects in C?, a.k.a. how do you accomplish things without objects, where you'd normally use objects?

In advance, thanks a lot. I've never used a language without OOP! :) 

EDIT: As per request, here is an example of the variable declaration issue:

/* includes, or whatever */
int main(int argc, char *argv[]) {
    int  myInt = 5;
    printf("myInt is %d\n", myInt);
    int test = 4; /* This does not result in a compile error */
    printf("Test is %d\n", test);
    return 0;
}

