Can anyone help me with this? Say I have the following struct:

```
typedef struct mystruct{
    int data1;
    int data2;
}mystruct;

```

And I created an array of struct using the below code:

```
main(void) {
    mystruct **new_mystruct = function();
    ... need to know the length of new_mystruct here ...
}

mystruct **function(){
    ... code to determine length of array here ...
    mystruct **new_mystruct= malloc(length_of_array * sizeof(mystruct));
    ... code to fill array here ...
    return new_mystruct;
}

```

What is the best way to return the length of my array, assuming length\_of\_array is dynamically generated during the run time of my function?

I hope I'm making sense. Thank you in advance.