I ask because my program didn't work and I didn't know why.
In [1] I had:
Code:
int qcheck(int , int *p);
in [3] I had:
Code:
int qcheck(holdans, int *p)
So I kept getting error messages because the int was missing in 3.
Another question, regarding pointers in functions.
Usually you do the following:
int a, *p
p = &a
*p = 10
However, with functions, you can leave out the p = &a by:
Code:
int qcheck(int , int *p);
Code:
qcheck (holdans, &score);
Passing the &score into a calling function to a called function that has int *p as a parameter, passing p to &score is therefore not necessary. Does the function do this automatically?
I got really confused and kept doing in main:
and then tried to because I thought it would pass the address.
I got it working in the end, but I kept thinking of pointing p to &score. Obviously this must not be necessary when passing pointers to functions.