I just made my first steps moving into Objective-C. I have a very simple question about how arrays works.
I have two .m files:
1)
Line = origin[6];
forloop(i...i++) {
origin[i]=7;
}
[buildSubview:origin];
2)
Line response[6];
-(id)buildSubview:(Line[])origin {
*response=*origin;
NSLog(@"response[1]=%o",response[1]);
NSLog(@"origin[1]=%o",origin[1]);
........
.....
}
The output I get is:
response[1]=0; <-- I would expect the same value as origin
origin[1]=7;
But if I ask to print the value at index 0 I get what I expected:
response[0]=7; <-- Now they are the same
origin[0]=7;
I am asking why two different values ? And also, why if I write
response=origin;
I get an incompatible assignment compile error?