# How to create the FMOD\_STUDIO\_EVENTDESCRIPTION array for use in FMOD\_Studio\_Bank\_GetEventList() (FMOD Studio C API)

**URL:** <https://qa.fmod.com/t/how-to-create-the-fmod-studio-eventdescription-array-for-use-in-fmod-studio-bank-geteventlist-fmod-studio-c-api/14110>\
**Category:** FMOD Studio\
**Created:** [September 20, 2018, 8:32am UTC](https://qa.fmod.com/t/how-to-create-the-fmod-studio-eventdescription-array-for-use-in-fmod-studio-bank-geteventlist-fmod-studio-c-api/14110 "2018-09-20T08:32:29Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jimmcgowan](https://avatars.discourse-cdn.com/v4/letter/j/67e7ee/32.png) [@jimmcgowan](https://qa.fmod.com/u/jimmcgowan)\
**Post date:** [September 20, 2018, 8:32am UTC](https://qa.fmod.com/t/how-to-create-the-fmod-studio-eventdescription-array-for-use-in-fmod-studio-bank-geteventlist-fmod-studio-c-api/14110/1 "2018-09-20T08:32:29Z")

</div>

I have loaded a bank and want to iterate through all the events it contains. From the documentation, it looks like I should use FMOD\_Studio\_Bank\_GetEventCount() to get the count of the events and use this count to create a buffer to pass to FMOD\_Studio\_Bank\_GetEventList() to retrieve an array of FMOD\_STUDIO\_EVENTDESCRIPTIONs.

However, FMOD\_STUDIO\_EVENTDESCRIPTION is defined in fmod\_studio\_common.h as

```
typedef struct FMOD_STUDIO_EVENTDESCRIPTION FMOD_STUDIO_EVENTDESCRIPTION;
```

i.e. an incomplete type. Therefore the compiler gives an error when trying to use

```
sizeof(FMOD_STUDIO_EVENTDESCRIPTION)
```

or

```
FMOD_STUDIO_EVENTDESCRIPTION array[count];
```

because it can’t determine the size of the FMOD\_STUDIO\_EVENTDESCRIPTION type.

So how are people creating buffers/arrays to use with this function? Am I missing something in the documentation?

Thanks, Jim

---

<div class="post-metadata">

**Author:** ![richard\_simms](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/richard_simms/32/261_2.png) [@richard\_simms](https://qa.fmod.com/u/richard_simms)\
**Post date:** [September 24, 2018, 4:13am UTC](https://qa.fmod.com/t/how-to-create-the-fmod-studio-eventdescription-array-for-use-in-fmod-studio-bank-geteventlist-fmod-studio-c-api/14110/2 "2018-09-24T04:13:45Z")

</div>

Hi Jim,

This is more of a C/C++ type question to do with allocating the memory needed for the array of event descriptions.

```
int i;
sfxBank->getEventCount(&i);
const int list = i;
FMOD::Studio::EventDescription** eventList = new FMOD::Studio::EventDescription*[list];
sfxBank->getEventList(eventList, i, &i);

```

You need to make the event description array and array of pointers for it to work.

Thanks,  
Richard

---

<div class="post-metadata">

**Author:** ![jimmcgowan](https://avatars.discourse-cdn.com/v4/letter/j/67e7ee/32.png) [@jimmcgowan](https://qa.fmod.com/u/jimmcgowan)\
**Post date:** [September 24, 2018, 4:43am UTC](https://qa.fmod.com/t/how-to-create-the-fmod-studio-eventdescription-array-for-use-in-fmod-studio-bank-geteventlist-fmod-studio-c-api/14110/3 "2018-09-24T04:43:36Z")

</div>

> [@](#):
>
> Hi Jim,
> 
> This is more of a C/C++ type question to do with allocating the memory needed for the array of event descriptions.
> 
> ```
> int i;
> sfxBank->getEventCount(&i);
> const int list = i;
> FMOD::Studio::EventDescription** eventList = new FMOD::Studio::EventDescription*[list];
> sfxBank->getEventList(eventList, i, &i);
> 
> ```
> 
> You need to make the event description array and array of pointers for it to work.
> 
> Thanks,  
> Richard

Hi Richard, Thanks for your answer, however I am using the C API, not the C++ API. In the C++ headers the EventDescription class is fully declared so

```
new FMOD::Studio::EventDescription*[list];
```
 will allocate the required memory for the array. In the C headers, the FMOD\_STUDIO\_EVENTDESCRIPTION type is not fully declared, therefore there is no way for the compiler to know the size of the type, and therefore no way to allocate the memory.

---

<div class="post-metadata">

**Author:** ![richard\_simms](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/richard_simms/32/261_2.png) [@richard\_simms](https://qa.fmod.com/u/richard_simms)\
**Post date:** [September 24, 2018, 1:02pm UTC](https://qa.fmod.com/t/how-to-create-the-fmod-studio-eventdescription-array-for-use-in-fmod-studio-bank-geteventlist-fmod-studio-c-api/14110/4 "2018-09-24T13:02:53Z")

</div>

Hi Jim,

Sorry, missed that part. Yes, there’s no “new” in C so you can use this instead:

```
FMOD_STUDIO_EVENTDESCRIPTION**eventList = (FMOD_STUDIO_EVENTDESCRIPTION**)malloc(sizeof(FMOD_STUDIO_EVENTDESCRIPTION*) * i);
```

---

<div class="post-metadata">

**Author:** ![jimmcgowan](https://avatars.discourse-cdn.com/v4/letter/j/67e7ee/32.png) [@jimmcgowan](https://qa.fmod.com/u/jimmcgowan)\
**Post date:** [September 26, 2018, 6:53am UTC](https://qa.fmod.com/t/how-to-create-the-fmod-studio-eventdescription-array-for-use-in-fmod-studio-bank-geteventlist-fmod-studio-c-api/14110/5 "2018-09-26T06:53:37Z")

</div>

Ah, I see. It is only required to allocation memory for the pointers to the descriptions, not the descriptions themselves. Thanks!
