Can I pass a struct to a function? What's the work-around? *TODO*

Talkback

Post a new comment?

Talkback #1 written by gannon on 2004-09-01.

No but there is a easy work around. First you need a global struct of the same type as the one you want to pass. Before you call the function copy the info of the struct into the temp struct. Then call the function that you to pass the struct to and have it use the temp struct. After it returns copy back the info from the temp struct to your struct. This will give you something like pass by reference (some differences but if you use the temp struct in everything you call before it returns you will be fine). Some real programming lang even use this way.

Post a new comment?

Ben McGraw's lovingly crafted this website from scratch for years.
It's a lot prettier this go around because of Jon Wofford.
Verge-rpg.com is a member of the lunarnet irc network, and would like to take this opportunity to remind you that regardless how babies taste, it is wrong to eat them.