#48440 - QuantumDoja - Wed Jul 20, 2005 12:04 am
Hi, I have the following structure: Question at bottom.
I have some variables of it like so:
and a function:
How can I pass into the update_combo function the defined variables as a pointer, i have tried it, but it keeps saying that all the members of the struct are not a struct or union!!
I have tried this to no luck:
_________________
Chris Davis
Code: |
typedef struct combo { u8 step; u16 difference; u8 stepmax; u16 sequence[7]; }combo; |
I have some variables of it like so:
Code: |
combo combo0; combo combo1; combo combo2; |
and a function:
Code: |
void update_combo(combo cb, int id) { if (keyDown(cb.sequence[cb.step])) { cb.difference = 0; if (cb.step == cb.stepmax) { cb.step = 0; } cb.step++; } else { cb.difference++; if (cb.difference > 40) { cb.step = 0; cb.difference = 0; } } } |
How can I pass into the update_combo function the defined variables as a pointer, i have tried it, but it keeps saying that all the members of the struct are not a struct or union!!
I have tried this to no luck:
Code: |
void update_combo(combo *cb, int id) { if (keyDown(*cb.sequence[*cb.step])) { *cb.difference = 0; if (*cb.step == *cb.stepmax) { *cb.step = 0; } *cb.step++; } else { *cb.difference++; if (*cb.difference > 40) { *cb.step = 0; *cb.difference = 0; } } } |
_________________
Chris Davis