Go to Post So yeah I love the minibot because it was a great vehicle to promote our team, make new friends, and possibly make sure a team makes it past their 1st or 2nd year. - Mr V [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 12-02-2008, 01:05
slavik262's Avatar
slavik262 slavik262 is offline
We do what we must because we can.
AKA: Matt Kline
FRC #0537 (Charger Robotics)
Team Role: Alumni
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Sussex, WI
Posts: 310
slavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to behold
Send a message via AIM to slavik262
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?
Attached Files
File Type: h LinkList.h (903 Bytes, 64 views)
File Type: c LInkLIst.c (2.6 KB, 68 views)
__________________

Last edited by slavik262 : 12-02-2008 at 01:11. Reason: Found something!
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

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


All times are GMT -5. The time now is 23:51.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi