Hi,
I am wondering if it is possible to determine how much space has been allocated for a particular pointer so I can determine how many elements are in its range.
The same method used for an array on the stack doesn't seem to work:
Code:
unsigned int *R_offd_i;
posix_memalign((void *)&R_offd_i, 16, 4 * sizeof(*R_offd_i));
printf("In Main: sizeof(R_offd_i) / sizeof(*R_offd_i) = %d / %d\n", sizeof(R_offd_i), sizeof(R_offd_i[0]));
The print statement prints " 4 / 4" which makes sense, but is not what I want.
I will address the obvious point and that is that the size is known when I allocate the space. I am passing R_offd_i to a function and that function needs to know how big it is and passing the size as a parameter is, well, going to make my function look like a complete mess so I am hoping to find another way.
Thanks