Expand|Select|Wrap|Line Numbers
- int a, b, c;
- int *t1;
- int *t2;
- t1 = malloc(3*sizeof(int));
- t1[0] = 1;
- t1[1] = 2;
- t1[2] = 3;
- t2 = malloc(3*sizeof(int));
- t2 = t1;
- a = t2[0];
- b = t2[1];
- c = t2[2];
- t2[0] = 5;
I then pieced together a 'copy' method:
Expand|Select|Wrap|Line Numbers
- void copy(int *to, int *from)
- {
- int c;
- for(c=0; c<sizeof(from)/sizeof(int); c++)
- {
- to[c] = from[c];
- }
- }
Thanks,