Raised This Month: $ Target: $400
 0% 

Variable from function to function?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Fean0r
Member
Join Date: Mar 2004
Location: Belfast, UK
Old 05-01-2004 , 16:13   Variable from function to function?
Reply With Quote #1

I collect the following information in public spec_target(id) - basically I get the information on a person I'm looking at..

Code:
new targetid[40],targetname[32], nid = read_data(2) get_user_authid(nid,targetid,39) get_user_name(nid,targetname,31)

Then I have a display to ensure i get the info (which it does)

Now I run another function public amx_testing(id)

My question is how can reference the targertname here?

Thanks[/small]
__________________
Fean0r
Fean0r is offline
xeroblood
BANNED
Join Date: Mar 2004
Location: Toronto, Canada
Old 05-01-2004 , 21:50  
Reply With Quote #2

make it a global variable
xeroblood is offline
Send a message via MSN to xeroblood
Fean0r
Member
Join Date: Mar 2004
Location: Belfast, UK
Old 05-02-2004 , 12:57  
Reply With Quote #3

Thanks.
__________________
Fean0r
Fean0r is offline
Johnny got his gun
Veteran Member
Join Date: Jan 2004
Location: Tokyo
Old 05-02-2004 , 14:40  
Reply With Quote #4

Code:
onefunction() {     new somestring[] = "hello"     anotherfunction(somestring) } anotherfunction(astring[]) {     // do stuff with astring here }

Just remember strings are passed by reference; if you change astring in anotherfunction, you also change somestring in onefunction because they refer to the same memory...
Johnny got his gun is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 11:45.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode