Lets say I make a function that takes a float*, the idea being that the function can access the values stored in the array.
bool Checkf(float *colors);
now inside the function i do this.
float tred = colors;
float tgrn = colors;
float tblu = colors;
is that right for what I want? I thought it would have to be
float tred = *colors;
but it gives me an indirection error when i do that.
The problem im haveing is with this function, I dont think its getting the right values from the passed array, but it still might be something else I havent thought of yet.
>float tred = colors;
This is correct. It's essentially saying take the value of the address pointed to by colors + 0 and place it in the float variable tred. You pass the float pointer by saying float *colors, which is the same as float colors. Array notation is allowed, and thank god for that :)
>float tred = *colors;
This is not correct. It says to go to the address pointed to by the value of the address of colors + 0 and place the value of that location in the float variable tred. colors is not a pointer, it's a float variable so the indirection is invalid, you can't dereference a float variable.
The two are very different, but subtlely so. I can see how this would be confusing.