I would like to know if in the code below (the variable 'p') is a Pointer to a Pointer Array?
#include <stdio.h>
int main () {
double valor = 7;
double *balance[5] = {&valor, &valor, &valor, &valor, &valor};
double **p;
p = balance;
return 0;
}
I would like to know if in the code below (the variable 'p') is a Pointer to a Pointer Array?
#include <stdio.h>
int main () {
double valor = 7;
double *balance[5] = {&valor, &valor, &valor, &valor, &valor};
double **p;
p = balance;
return 0;
}
The answer to your question is yes, when you did double **p
you created a variable that is a pointer to a double
pointer. When accessing the value of P
, use *p[índice]
.
#include <stdio.h>
int main (void)
{
double valor = 7.0;
double *balance[5] = {&valor, &valor, &valor, &valor, &valor};
double **p;
p = balance;
int i=0;
for(i=0;i<5;i++)
printf("%lf\n",*p[i]);
return 0;
}
See working at ideone .