Page 1 of 1

Posted: Sat Jan 04, 2003 9:06 am
by BackupUser
Restored from previous forum. Originally posted by JohnDeHope3.

Can a structure be used as the data type for a procedure parameter? Is this something other people would like? Is there a reason why this is not good?

Posted: Sat Jan 04, 2003 9:52 am
by BackupUser
Restored from previous forum. Originally posted by BigSnake.

Code: Select all

structure a
  a.l
  b.s
  c.b
endstructure

procedure ChangeA(*A.a)
  *A.a = 15
endprocedure

Global B.a

ChangeA(B) 

Posted: Sat Jan 04, 2003 9:55 am
by BackupUser
Restored from previous forum. Originally posted by JohnDeHope3.

Ahh... So what you are saying is that the parameter should be a pointer, and that then I'll be OK? Do I have to prefix the parameter name (A in your example) with * everywhere in the procedure, or just in the top declaration line?

Posted: Sat Jan 04, 2003 9:55 am
by BackupUser
Restored from previous forum. Originally posted by BigSnake.

ups sorry

Code: Select all

*A\a = 15

Posted: Sat Jan 04, 2003 9:57 am
by BackupUser
Restored from previous forum. Originally posted by BigSnake.

Yes, everywhere with the * prefix. If you don´t, you change the adress of the pointer; be carefull.

Posted: Sat Jan 04, 2003 9:58 am
by BackupUser
Restored from previous forum. Originally posted by JohnDeHope3.

I didn't catch that the first time! So do I have to say "*A\a" every time, or can I also say just "A\a" ?

Posted: Sat Jan 04, 2003 10:02 am
by BackupUser
Restored from previous forum. Originally posted by JohnDeHope3.

With a little test programming it seems you need to use the "*" everywhere. That's annoying! But hell at least now I can pass structures into my programs, which is nice.