Referencing an array to a pointer
- by james
I want to refer a pointer to an array by another pointer.
Example:
void exp()
{
double var[2];
exp1(&var[0]);
printf("\n varvalue is %lf\n",var[0]);
}
void exp1(double *var)
{
//updating the value
*var[0]=4.0;
exp2(&var[0]);
}
void exp2(double *var)
{
*var[0]=7.0;
}
This should update the value as 7.0(the last update).I am getting an array like invalid argument type of unary(*) . How can i correct this?where i am going wrong here?