Referencing an array to a pointer

Posted by james on Stack Overflow See other posts from Stack Overflow or by james
Published on 2013-11-09T15:49:31Z Indexed on 2013/11/09 15:53 UTC
Read the original article Hit count: 151

Filed under:

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?

© Stack Overflow or respective owner

Related posts about c