|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
Dynamic Memory Allocation Woes
Hello,
For hybrid, we're using encoders on our drive train as well as various other sensors to place ourselves on an imaginary (x,y) coordinate grid on the field. I have created code that allows you to store a list of points. It consists of a structure with two values (x and y) as well as a pointer to point to the next structure of the same type. Basically, coodrinates are inserted into the heap using dynamic memory allocation (using the malloc funciton). Using the functions I created, these lists are then strung together using pointers. Using pointers, you can insert another block between two blocks in the list (say if we have to navigate around something) or delete blocks. Look at my code for details. I've commented it as best I can. I have seen this type of data structure called either Link Listing or Memory Blocks. All of my code has been taken almost line-for-line by How to Program C by H.M. Deitel and P.M. Deitel, with a few cosmetic changes. My problem is that despite including stdio.h and stdlib.h, the compiler claims that the funcion malloc does not exist, giving me the "use of function without prototype" and then an entire slew of errors. Upon further inspection, I found that the default stdlib.h and stdio.h don't even contain a function prototype for malloc! I am using MPLAB Is there something I'm missing? Any help would be Greatly appreciated. My code is attached to this post. EDIT: After searching a bit I found this. Can I use this in the way I want to? Last edited by slavik262 : 12-02-2008 at 01:11. Reason: Found something! |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Random Allocation of Trackballs | fabalafae | Rules/Strategy | 7 | 07-01-2008 09:31 |
| Please help: Memory allocation problem dealing with sections | RbtGal1351 | Programming | 10 | 14-03-2006 14:58 |
| Animation Woes | Team905Animator | 3D Animation and Competition | 1 | 15-02-2005 16:34 |
| Transmission Woes | Madison | Motors | 3 | 19-02-2002 10:06 |
| Gear Woes | Simon G | Technical Discussion | 14 | 24-01-2002 16:31 |