I'll start by saying sorry for my ignorance - I am 100% a hobby C programmer for a text-based game. I am a professional C# developer (sorry) so most of my problems are around pointers - and this is one of them.
I have two functions, headed:
the first is small so I'll post it:
void one_hit args((CHAR_DATA *ch, CHAR_DATA *victim, int dt, int wpn));
int get_one_hit_damage args((CHAR_DATA *ch, CHAR_DATA *victim, int dt, int wpn));
the second is huge but to cut a long story short, it returns an integer and, importantly, changes the value of dt.
void one_hit(CHAR_DATA *ch, CHAR_DATA *victim, int dt, int wpn)
int dam = get_one_hit_damage(ch, victim, dt, wpn);
if(dam == -1) return;
damage(ch, victim, NULL, dam, dt, wpn);
Having read all I can about passing parameters by reference in C, I have come to this conclusion (echo'd in the header, or without - same error):
... I get the impression that using the & here infront of the dt parameter should make it a reference parameter. However when I compile I get...
int get_one_hit_damage(CHAR_DATA *ch, CHAR_DATA *victim, int &dt, int wpn)
dt = 1;
I've tried putting the same & in the function header but it doesn't like that either.
fight.c:611: error: expected ';', ',' or ')' before '&' token
I'm sure this is simple but I just don't know how to work it...
Can anyone help?