Computer Science Canada Saving a variable as a variable?? |
Author: | Lucas [ Thu Mar 24, 2011 7:01 pm ] | ||
Post subject: | Saving a variable as a variable?? | ||
What is it you are trying to achieve? I would like to save a number to two different variables, and make it so that if i change the value of one variable, the value of the other variable changes as well What is the problem you are having? not sure how do this Describe what you have tried to solve this problem asking you guys ![]() Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
Please specify what version of Turing you are using 4.1.1 |
Author: | Tony [ Thu Mar 24, 2011 7:16 pm ] |
Post subject: | RE:Saving a variable as a variable?? |
you are looking for pointers |
Author: | z_cross_fire [ Thu Mar 24, 2011 7:56 pm ] | ||||
Post subject: | Re: Saving a variable as a variable?? | ||||
I haven't heard of pointers...and I haven't learnt turing, so this is what I did in C# (if anyone can convert it to turing, it would be helpful to OP) First, I created a class called SameValue:
This is the Main Program:
The code will print 10. All this does, is that it gives both 'a' and 'b' access to change the 'val' integer... |
Author: | Tony [ Thu Mar 24, 2011 8:02 pm ] |
Post subject: | RE:Saving a variable as a variable?? |
@z_cross_fire: "new" returns a pointer ![]() |