![]() |
|
#1
|
|||
|
|||
Using pointer as a parameterI have a pointer variable in main function.(linked list)
i need to pass that pointer to a function. in the function,it will change the pointer contents.(added new items) But i need the original pointer as it is. so, how can I use a copy of that pointer(link list) within that function. actually i need to getseveral paths in a diagrem,path is starting from (0,0). destination is (7,7). I have to find all the posible paths.Thats y i used linked list. So,I try to start from frist position. when path is divided , i need to get two different paths.So, i ll try to use that stroed linked list's 2 copies and want to store the rest. So,can any 1 gv me any idea please. |
|||
|
#2
|
|||
|
|||
Re: Using pointer as a parameterYou should probably pass a pointer to that pointer:
CPP / C++ / C Code:
Or, if it is fairly simple, you could pass the pointer as an argument to the function and return it from the function like so: CPP / C++ / C Code:
|
|
#3
|
|||
|
|||
Re: Using pointer as a parameterDear Friend,
You can pass the pointer variable to the function,. Inside the function you can change, what ever you want. You are implementing the linked list. So you might use structure. If you call some function from the main function, inside the calling function you can declare some other structure variable. So you can assign the argument value to the newly created variable. Finally in the return statement you should use the newly created variable. |
Recent GIDBlog
Vista ?Widgets? on Windows XP by LocalTech
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| MACRO to detect big / little endian | ahbi82 | C Programming Language | 14 | 26-Aug-2007 10:33 |
| Passing strings by reference | odrium | C++ Forum | 7 | 18-Jul-2007 22:27 |
| Help with syntax errors | PeteGallo | C Programming Language | 7 | 08-Aug-2005 20:30 |
| [Tutorial] Pointers in C (Part II) | Stack Overflow | C Programming Language | 0 | 27-Apr-2005 17:36 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The