I need to read inputs from a csv and put it into a dynamically allocated array
Ay
.
int* Ay = malloc(nz * sizeof(int));
The number of inputs from the csv will vary in each case. Later I pass Ay
to another function where I need to calculate its length. I have used the following methods but it doesn't give me the right result.
int Aylen = sizeof(Ay) / sizeof(Ay[0]);
or
int Aylen= 1[&Ay] - Ay;
or
int Aylen=*(&Ay+1)-Ay;
Please suggest a way to find the length. Thank you.