![]() |
|
#1
|
|||
|
|||
newbie with pointer problems.i am having a problem with two of the functions in a wave program i am trying to construct. the function current wave is supposed to display the current/last wave in the graphics window but unfortunately it only ever displays the first wave. the function summation wave suffers from the same problem. i believe this is due to bad use of pointers but it may also be down to the if else statements i have used within the functions. any help with this problem would be greatly appreciated..
|
|
#2
|
||||
|
||||
|
Quote:
Hi Moltarim. I am so sorry that i haven't gotten to this sooner. I have been so busy with other things. I do see that you have used some of my advice in your code. You are definitely having some pointer (or linked list) problems. I am assuming that all of your data is inserting correctly though. For example here: CPP / C++ / C Code:
I am not sure what you are trying to do. if head is null than there is no data in the list and you should not even try to access it after that! Then later, you have: CPP / C++ / C Code:
Which is simply assigning the current position to the top of the list every time. Your summation routine is having the exact same problem, so you are always printing/summing only the first wave. The way that this is set up is that current should be always pointing at the "current" location. This "current" location is changed in your main switch function here: CPP / C++ / C Code:
The first will position the current at the head of the list, the next one will index down the list one at a time. So when you enter these functions (draw_wave & summation_wave) the only thing you should check for is that current is actually pointing to something, by simply saying. CPP / C++ / C Code:
Hope this isn't too late to help you out. I should have looked at this sooner. I just got to busy with other things. Good luck, d |
Recent GIDBlog
Python ebook by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Basic pointer problems | Trust | C Programming Language | 1 | 09-May-2004 06:07 |
| Chaintech Geforce 5600 FX problems | bartster74 | Computer Hardware Forum | 8 | 04-May-2004 13:16 |
| Please Help, problems writing newbie c program | soulfly | C Programming Language | 14 | 04-Mar-2004 15:16 |
| Please Help, problems writing newbie C program ReREVISED | soulfly | C Programming Language | 0 | 02-Mar-2004 22:01 |
| convert long to pointer to char | realpopeye | C++ Forum | 2 | 26-Sep-2003 10:22 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The