I have bug when calling to a function dynamic_arr - somehow I loose all my array and only
the first element being returned.
In my code my main calls a function that dynamically needs to create an array
and after the user will insert the elements of the array all the array needs to be passed to
function funcdosomthing.
But at the moment function funcdosomthing gets only the first element and not all the array.
Just to make clear that everything else works - when I don't use function dynamic_arr and
set the array manualy int a[] = {1, 0, 2}; everything works fine and function funcdosomthing gets all the array with 3 elements.
Here's my code:
int *dynamic_arr(int n)
{
int i, *a;
a = (int*)calloc(n, sizeof(int));
for(i=0;i<n;i++) scanf("%d",a+i);
return a;
}
int mainprograma()
{
int n,*a,i;
scanf("%d",&n);
a=dynamic_arr(n);
funcdosomthing(a, sizeof a / sizeof a[0]);
...