I am unable to use * to acquire the value of the address that ReturnedArrayPointer has.
The comments in the code should explain in more clearly.
Code:
#include"Header.h"
/* These are in Header.h
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
*/
int Colour(ReturnedArrayPointer, ArraySize)
// The call is this: Colour(ReturnedArrayPointer, ArraySize);
// Declared as: int *ReturnedArrayPointer = 0;
// ReturnedArrayPointer is given the first adress in my array before the call gets it here.
// ArraySize = 3.
{
for (int i = 0; i < ArraySize; i++)
{
printf("\nSize: %d\n", ReturnedArrayPointer);
// The value of the adressess are: 1, 2, and 3. In that order.
// *ReturnedArrayPointer gives the error: Operand of '*' must be of a pointer.
// So how do I display the value it's pointing at?
printf("Size adress: %d\n", ReturnedArrayPointer); // Works as intended.
ReturnedArrayPointer += 1 * 4;
printf("Colour: %s\n", ReturnedArrayPointer); // I have no idea why this provides the value of the adress.
printf("Colour adress: %d\n", ReturnedArrayPointer); // And that this works as intended.
ReturnedArrayPointer += 8 * 4;
}
getch();
}
Running this part gives:
I'm using MVS Express 2013 and the C++ compiler (and .c source files).
OS: 64 bit Win7.
Thank you for your time.