Computer Science Canada A Guide to Pointers in Turing |
Author: | kalev [ Mon Apr 06, 2009 6:08 pm ] | ||
Post subject: | A Guide to Pointers in Turing | ||
Pointers are an extremely powerful programming tool. The Turing language makes it much more difficult to use pointers than other languages. The purpose of this Tutorial is to teach you, the reader and avid beginner programmer, how to use pointers in Turing, just like in higher level languages such as C++ or Java. What is a pointer? To begin with, you must understand what a pointer is. To understand what a pointer is, you must understand what a variable is, and how computers interact with them. Every variable is a bunch of memory stored at a place in the computer's memory. Just like your home address, each variable also has an address. A pointer is a variable that stores the address of another variable. When a pointer stores an address of a variable, it is said that it points to that variable. The variable a pointer points to is refered as the variable pointed to by (pointer name). Unfortunately, the Turing language makes it easy to confuse objects, and true pointers. Turing also make it difficult to use "true pointers". To quote the Turing documentation, pointers "are inherently error prone and cause difficult to locate bugs". However, pointers are not impossible to use in Turing. The following example shows how to use a pointer.
Feel free to play with the above code. If i left out something important, or made a spelling/grammer mistake, feel free to let me know and i will gladly edit. Note: see Turing help's pointer section for detailed info on using Turing's "normal" pointers (checked by default ones) |
Author: | kalev [ Tue Apr 07, 2009 6:46 pm ] | ||||
Post subject: | Example of a use of Pointers in Turing | ||||
Here's a method of creating a linked list in Turing:
Here's a code demonstrating record incomparability.
|
Author: | Tyr_God_Of_War [ Thu Jun 18, 2009 5:33 pm ] | ||
Post subject: | Re: A Guide to Pointers in Turing | ||
You can use nil instead of your node 'null'
I think that's a bit easier. |
Author: | apomb [ Fri Jun 19, 2009 12:25 am ] |
Post subject: | RE:A Guide to Pointers in Turing |
but... why? |