ivanachukapawn2
Technical User
A tutorial says:
float* px;
defines px as a pointer to a float.
AND LATER
float *px;
defines px as a pointer to a float
I am a C newbie and find this very confusing. Can you confirm, are these 2 statements (defining px as a pointer) equivalent?
Is there one way of declaring a pointer predominately used and/or preferred?
Further on in the tutorial, I find this:
The content of the memory location referenced by a pointer is obtained using the ``*'' operator (this is called dereferencing the pointer). Thus, *px refers to the value of x.
This is confusing also. In a previous example, the tutorial states that *px declares px to be a pointer, but in this example *px is said to dereferenc the pointer. When I encounter *px in code how can I discern its meaning?
float* px;
defines px as a pointer to a float.
AND LATER
float *px;
defines px as a pointer to a float
I am a C newbie and find this very confusing. Can you confirm, are these 2 statements (defining px as a pointer) equivalent?
Is there one way of declaring a pointer predominately used and/or preferred?
Further on in the tutorial, I find this:
The content of the memory location referenced by a pointer is obtained using the ``*'' operator (this is called dereferencing the pointer). Thus, *px refers to the value of x.
This is confusing also. In a previous example, the tutorial states that *px declares px to be a pointer, but in this example *px is said to dereferenc the pointer. When I encounter *px in code how can I discern its meaning?