P
Pushkar Pradhan
I have a struct like this:
struct point {
int x;
int y;
};
Then I need to assign a certain point "=" another pt.
eg.
struct point p1, pArr[10];
/* initialize all pts. */
Now assign p1 to a certain element of pArr, this is how I did and it
works fine.
p1 = pArr[someIndex];
However, I just read my C book again and it says this stuff must be done
like this actually:
p1.x = parr[someIndex].x;
p1.y = parr[someIndex].y;
Can anybody tell if I should continue with the former code or should I
make changes?
Pushkar Pradhan
struct point {
int x;
int y;
};
Then I need to assign a certain point "=" another pt.
eg.
struct point p1, pArr[10];
/* initialize all pts. */
Now assign p1 to a certain element of pArr, this is how I did and it
works fine.
p1 = pArr[someIndex];
However, I just read my C book again and it says this stuff must be done
like this actually:
p1.x = parr[someIndex].x;
p1.y = parr[someIndex].y;
Can anybody tell if I should continue with the former code or should I
make changes?
Pushkar Pradhan