I'm trying to return an array of integers from a function, sort the numbers then pass everything back to main. I haven't allocated and freed memory in this piece of code. I was just trying to see if it would actually work. The compiler flags an error for the statement b=sort(a)
. It says that it is not assignable, which would make sense. The input integers are not pointers. Is there a way to declare an array of integers as pointers? such as :
int *a[5]={3,4}
#include <stdio.h>
#include <stdlib.h>
int *sort(int *input_array);
int *sort(int *input_array)
{
return input_array;
}
int main()
{
int a[5]={3,4};
int b[5];
b=sort(a);
return 0;
}