I'm not exactly sure what you're after. Your question wasn't clear enough for me, sorry.
I made a small program that asks the user to provide the size of the array (no check is done on the input, the user can enter anything silly, not even numbers). Then this number is used to initialize an array with this size. Then I fill the array with some data (Fibonacci-sequence, because why not?) then read it.
A very important thing to note here: the variable myArray has a limited lifetime: it can only be accessed (directly or via a pointer) for the duration of its scope (while SetSize() hasn't terminated).
Another note: you only need what's highlighted, the rest is just me playing around and demonstrating that the array works.
#include <stdio.h>
static void PutFibonacci(unsigned long * array, size_t size)
{
for (size_t i = 0u; i < size; i++)
{
switch (i)
{
case 0u: array[i] = 0ul; break;
case 1u: array[i] = 1ul; break;
default: array[i] = array[i - 1] + array[i - 2]; break;
}
}
}
static void PrintArray(unsigned long * array, size_t size)
{
for (size_t i = 0u; i < size; i++)
printf("F(%lu):\t%lu\n", i, array[i]);
}
static size_t GetSizeFromUser()
{
size_t size;
printf("Please, enter the size of the array: ");
scanf("%lu", &size);
return size;
}
static void SetSize(size_t size)
{
unsigned long myArray[size];
// Do something with it. I'll just put the Fibonacci-sequence in the array then read them back
PutFibonacci(myArray, size);
PrintArray(myArray, size);
}
int main()
{
size_t size = GetSizeFromUser();
SetSize(size);
}
If this is not quite what you were after, please try to be more specific of what you're trying to achieve. Maybe write some code and we can help when it doesn't work correctly.