EXAMPLE NEED FOR FUNCTION WITH BY REFERENCE AND FUNCTION WITH BY VALUE

 

DEAR SIR

FUNCTION ONE ()

{

BUYSTOP=1;

RETURN BUYSTOP;

}


HOW TO SET THE BUYSTOP VARIABLE FORM OUTSIDE FUNCTION AND HOW TO CHECK THE VALUE OF BUYSTOP VARIABLE OUT SIDE THE FUNCTION

IN SIMPLE I NEED TO GET , SET AND CHECK THE VARIABLE VALUE DEFINED WITH IN THE FUNCTION FROM OUT SIDE THE FUNCTION


PLEASE GIVE ME AN EXAPLE FOR THIS


THANKYOU




 

in your main code

int BuyStop;
Function1(BuyStop);

 function

void Function1(int &bs)
  {
  bs=1;
  }

 PS please don't post in capital letters. It is considered rude in forums

 

please give me an fully solved example

else it is not possible for me to understand

it is my humble request

 
SELVAN:

please give me an fully solved example

else it is not possible for me to understand

it is my humble request




Sorry, but i have no idea what you want. Your post is not very clear.

I gave you an example where the variable BuyStop is passed by reference to the function and then the function gives that variable the value 1 

Have you edited your original post? I am sure that it is not the same post that i replied to. 

 
GumRai:

in your main code

 function

 PS please don't post in capital letters. It is considered rude in forums

 

As Gum said, it is bad form.  In text conversation, it is the equivalent of yelling all the time.
 
SELVAN:

please give me an fully solved example

else it is not possible for me to understand

it is my humble request




The best way for you to learn is to have someone point you in the right direction, and have you learn how to do the rest yourself.  For future reference, when posting code, it is suggested that you use the SRC button located at the top of the message entry area, and paste your code pieces within that area.  If you are showing you are trying to work out the problem for yourself, but having issues with it, people seem to be more likely to be willing to help you out when you get stuck, as well.  Basically, if you think it is something worth putting effort into, even if you are not getting it quite right, they will be more encouraged to help you.
Reason: