Can someone set the path straight on the disparities between these ubiquitous, as It can get a bit mind blowing.
For example if I have a 2D array such as rec[3][2]
, the following access means the same;
rec[0][0] = **rec
rec[i][0] = **(rec + i)
*(*(rec + i) + j) = rec[i][j]
If this is the case then what are the meaning of these:
#include <stdio.h>
double *recptr[3];
int i=1;
main()
{
double n1=12.0;
doublw n2=3.4;
recptr[0]= &n1;
recptr[1]= &n2;
printf("Amt: %.2f\n", **(recptr + i));
}
What is **(recptr + i)
, Is this access to 2D pointer or ponter-to-pointer reference?
foo(ptr2ptr)double **ptr2ptr;
{
int i=1, j=0;
if(**(ptr2ptr +i) > **(ptr2ptr + j))
{
double *tmp= *(recptr +i);
}
}
Again what is the difference between *(recptr +i)
and **(ptr2ptr +i)
?! is the later also 2D access or access to pointer-2-ponter reference and the earlier the object pointed to?