Passing array size

You need to allocate some memory for the array first. What is the biggest number of samples you want to allow, then make that the initial size.

You can also learn about malloc, calloc, realloc and free.