Author Topic: pointer of pointer  (Read 1788 times)

0 Members and 1 Guest are viewing this topic.

Aurel

  • Guest
pointer of pointer
« on: November 05, 2013, 02:37:54 PM »
hey...i found this c example on codeproject site
and wow...it work in Oxygen to  ;D
Code: [Select]
int a=50
sys b
b = &a
*b = 100
print str(a)
sys c
c = &b
**c = 200
print str(a)

Aurel

  • Guest
Re: pointer of pointer
« Reply #1 on: November 06, 2013, 02:52:51 AM »
hmm
I don't know is this proper way to create string pointer but it looks that sys not work
only char type created as pointer *ps ...
Code: [Select]
Declare Function MessageBox Lib "user32.dll" Alias "MessageBoxA" (ByVal hwnd As Long, ByVal msg As String, ByVal cap As String,ByVal mType As sys) As int

int a=50
sys b
b = &a
*b = 100
print str(a)
sys c
c = &b
**c = 200
print str(a)
'string
string s="oxygen"
char *ps   'pointer
ps = s     'point our pointer ps -> s
 
MessageBox 0, ps,"Test Pointer",0
'print ps

Aurel

  • Guest
Re: pointer of pointer
« Reply #2 on: November 06, 2013, 03:09:41 AM »
or maybe this one ...
i am just testing some things ;D

Code: [Select]
Declare Function MessageBox Lib "user32.dll" Alias "MessageBoxA" (ByVal hwnd As Long, ByVal msg As String, ByVal cap As String,ByVal mType As sys) As int

int a=50
sys b
b = &a
*b = 100
print str(a)
sys c
c = &b
**c = 200
print str(a)
'string
string s="oxygen"
char *ps   'pointer
ps = s     'point our pointer ps -> s
 
MessageBox 0, ps,"Test Pointer",0
'print ps
string s2="oxygen2"
char *p2
p2=s2   ' new pointer p2 hold s2 content
ps=p2   ' old pointer set with new pointer  / is this ok ????
print ps

Charles Pegge

  • Guest
Re: pointer of pointer
« Reply #3 on: November 06, 2013, 03:43:12 AM »
The reference level differs for each kind of string, so the only reliable way is to use strptr

string s="Hello"

char*c

strptr c=strptr s

print c