• 13
• 16
• 27
• 9
• 9

# ByRef Keyword

This topic is 3407 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

hi everyone, i was just following a tuorial i found on gp wiki about creating a way to creat a tile map and render it, this tutorial is done in visual basic and in the turorial i noticed that as we were creating a function he used a keyword that i am unfamiliar with "ByRef", i have very little experience in visual basic as i am mainly a c++ programmer, and being that c++ programmers are very perserverent people i went out to find out what byref was "Specifies that an argument is passed in such a way that the called procedure can change the value of a variable underlying the argument in the calling code." this sounds very similar to what you can do with a function by declaring one of the arguments as a pointer and refrencing a variable to it on a call. eg. void changeNumber(int* numtochange) { *numtochange = 4; return; } /* imagine this being called elsewere from another function */ changeNumber(&variablebeingchanged); so basically what im asking here is -> is this byref keyword something like the equivalent to the example i just showed above, if not mabye someone can explain or direct me to a more indepth and helpful explanation than those ones that the visual studio documentation provides. but genereally if this is the case a yes or no would suffice, or further advice or insite is always welcome

##### Share on other sites
Perhaps a better example would be:

void changeNumber(int& numtochange){    numtochange = 4;    return;}

ByRef means "pass by reference" (as opposed to ByVal which means "pass by value").

##### Share on other sites
thx i'll try that out, ummm while we're here is there still a function called BltFast in directx 9? or is there anything similar? im kinda in need of some blitting powers.