Hi Charles ..All :)
is this only way to cast float variable in o2 ?
using in this case dereferece * ...
float n
'INT i at strptr s ' integer pointer cast string s
n = 3.14
sys *p = @n
float f2 = (float)p
print f2
I am looking in all examples ...functionPointers 1 and 2
and not understand it well
like in old EBasic where is used :
print *<float>p
is that syntax even possible in o2
if you ask me i am fine with (float)
but above looking more fancy ...?
Hi Aurel,
This shows the o2 syntax alternatives for casting pointers:
'casting pointers
=================
float n = 3.14
sys p = @n
float f2
f2 = (float*) p
print str(f2,2)
print str((float*)p,2)
print str(cast(float*)p,2)
print str(cast float*p,2)
Thanks Charles
but why this one work
sys *p = @n
i just tried ..i don't know that work or
simply i expected that not work ...
because of dereferencing symbol *
of course this looks better:
f2 = (float*) p
sys *p=@n won't work on the current system. Too much referencing! Just use plain p as a variable that contains the address of n