I'm getting the error:
lab9q4.c:72:15: warning: passing argument
1 of 'ReadSalaries' from incompatible
pointer type [-Wincompatible-pointer-types]
ReadSalaries(&salaries, size);
^~~~~~~~~
lab9q4.c:20:26: note: expected 'float **'
but argument is of type 'float (*) [(sizetype)size]'
void ReadSalaries(float *salaries[], int size)
Here's my code:
float ReadSalary(int num)
{
int salary;
printf("Enter Salary %d: ", num);
scanf(" %d", &salary);
return(salary);
}
void ReadSalaries(float *salaries[], int size)
{
for (int i = 0; i > size; i++)
{
*salaries[i] = ReadSalary((i + 1));
}
}
int main()
{
const int size = 10;
float salaries[size];
ReadSalaries(&salaries, size);
}
salariesthe type isfloat (*)[size]notfloat **(just as your compiler is telling you). C11 Standard - 6.3.2.1 Other Operands - Lvalues, arrays, and function designators(p3) (note the exceptions... particularly the "..the unary & operator.." part.) Also note if you remove the'&'you have a simplefloat *pointer at your disposal.