Float*

Hi,

I’m trying to make a loop with a while, but while function doesn’t accept float* as an argument to stop.

I have a few questions about this type of declaration:

What is float*?
What’s the diference between float* and float?
And how do I transform float* in to float?

Thanks,


Thiago dos Santos Pinto
Brasil

A float * type is a pointer to a float variable.

You don’t convert a float * into a float… they’re different things. But you can dereference it to access the float value it points at by prepending a “*” to the variable. So for example,

float *a=somePointer;  // can also be written float* a	 or float * a 

float b = *a; // dereference it

This is all just like classic C (not GPU specific) so all the classic C references can explain it.

A float * type is a pointer to a float variable.

You don’t convert a float * into a float… they’re different things. But you can dereference it to access the float value it points at by prepending a “*” to the variable. So for example,

float *a=somePointer;  // can also be written float* a	 or float * a 

float b = *a; // dereference it

This is all just like classic C (not GPU specific) so all the classic C references can explain it.