![]() |
|
#1
|
|||
|
|||
Heaps using the vector classhello.I've written a function which is supposed to get an index of a vector and checks for the value of that index in the vector if it is smaller than his children and if so than replaces between the two and calls the function again in recursion with the bigger son's index.the problem is that I get a segmentation fault when I try to activate the function.
here is the program: CPP / C++ / C Code:
can you tell me where is the bugg or how to fix it because I really have no clue. thank you in advance. |
|||
|
#2
|
|||
|
|||
Re: Heaps using the vector classsI've found the error.but I have a qeustion:why can't I initialize a vector like an array? I've used push_back() instead but it pushes it to the top of the vector.
|
|
#3
|
|||
|
|||
Re: Heaps using the vector classsQuote:
The vector class has an "iterator consctuctor" that you can use to initialize a vector from an array: CPP / C++ / C Code:
Output Code:
Regards, Dave |
Recent GIDBlog
Programming ebook direct download available by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Heaps and stacks!..what about pointers passed as arguments | aijazbaig1 | C Programming Language | 4 | 04-Feb-2008 10:13 |
| Non-local heaps and assertion errors | Marius | MS Visual C++ / MFC Forum | 1 | 03-Sep-2004 06:45 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The