I am trying to send array (which is an object?) that contains random integers. I want to send the array to sort() in order to sort the array, but when I am parsing array to sort() I get the following error: error: dereferencing pointer to incomplete type
. Please, if you are changing anything in the code, please please explain what you are doing and why you are doing it because I am already confused about the code as it is right now.
I am not allowed to change the code in array.c or array.h, and void_sort()'s argument can not be changed.
array.c
struct array {
int* data;
int size;
};
struct array* array_create()
{
struct array* array = (struct array*) malloc(sizeof(struct array));
array->data = (int*) malloc(sizeof(int) * 10000);
array->size = 10000;
return array;
}
array.h
typedef struct array* ARRAY;
ARRAY array_create();
main.c
void sort (int A[], int N)
{
// Sort the array
}
ARRAY array;
array = array_create();
sort(array->data, 100); // This gives me error: dereferencing pointer to incomplete type