The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
Google UNIX.COM


High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
far pointer useless79 High Level Programming 1 11-08-2007 02:13 AM
A Pointer to non-Virtual Address, and All of my Hard drive xcoder66 High Level Programming 9 12-19-2005 02:22 PM
pointer sarwan High Level Programming 1 11-15-2005 03:41 AM
How to Achive IP address through MAC(Ethernet) address krishnacins IP Networking 3 08-29-2005 05:45 PM
network address and broadcast address? pnxi UNIX for Dummies Questions & Answers 7 11-10-2003 08:29 PM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #15  
Old 08-15-2006
Registered User
 

Join Date: Jul 2006
Posts: 25
Quote:
Originally Posted by Poison Ivy
this is still not working i get an empty line
at the top *firstFree = heap is suppose to make heap point at the first value right? then later on i change the address of firstFree so it points at first free memory space.. so i'm wanting that address to use in the for loop

i'm not sure what im doing anymore
Reply With Quote
Forum Sponsor
  #16  
Old 08-15-2006
Hitori's Avatar
Registered User
 

Join Date: Jun 2006
Posts: 360
Try to dump your program and post here what values have firstFree and heap (use gdb or so) in dumpHeap()
Reply With Quote
  #17  
Old 08-15-2006
Registered User
 

Join Date: Jul 2006
Posts: 25
Quote:
Originally Posted by Hitori
Try to dump your program and post here what values have firstFree and heap (use gdb or so) in dumpHeap()
im kinda new to this so umm what do u mean
Reply With Quote
  #18  
Old 08-16-2006
Hitori's Avatar
Registered User
 

Join Date: Jun 2006
Posts: 360
Compile your programm with gcc -g (with debug info) and then run it with gdb (gdb programm). Look at man gdb or http://www.gnu.org/software/gdb/documentation/ for more info
Reply With Quote
  #19  
Old 08-16-2006
Registered User
 

Join Date: Aug 2006
Posts: 21
char heap[ 134 ];
char *firstFree = heap;

This is your first two lines of code
heap - is a character array
firstFree - is a character pointer which can hold an address of a variable

heap - holds the address of the first location of the array heap[134]

so the second line must be

firstFree=heap;

Regards
kingskar
Reply With Quote
  #20  
Old 08-16-2006
Hitori's Avatar
Registered User
 

Join Date: Jun 2006
Posts: 360
Quote:
Originally Posted by kingskar
char heap[ 134 ];
char *firstFree = heap;

This is your first two lines of code
heap - is a character array
firstFree - is a character pointer which can hold an address of a variable

heap - holds the address of the first location of the array heap[134]

so the second line must be

firstFree=heap;

Regards
kingskar
No,
char *firstFree = heap;
equals to
char *firstFree;
firstFree = heap;


It's just a combination of declaration of pointer to the charachter and it's definition.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 07:31 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0