Oh okay, thanks for the very speedy reply.
Unfortunately that doesn't completely solve my problem. To expand on the exercise I have a function with a signature like this:
This method basically uses malloc() and calloc() to allocate memory for the array object, and returns a pointer to the array through the "array" parameter. I then have functions later on for manipulating the array, such as:
int array2d_create(Array2D *array, int columns, int rows)
int array2d_get(Array2D *array, int column, int row)
In each of these functions I want to test if the pointer "array" is actually pointing to an "Array2D" object, and return an error code if it isn't.
int array2d_set(Array2D *array, int column, int row, int value)
Since there is no guarantee that the user of the functions (which are being used in a basic library) will initialise the pointer to NULL when it is created, how could I test if the pointer has been initialised to point to a structure before it is used?