Re: malloc()/realloc() - have I got this right?



Dave wrote:

I'm teaching myself C by working my way through Steve Summit's
tutorial (http://www.eskimo.com/~scs/cclass/cclass.html). In one
of the questions (assignment 6, exercise 7), you have to write a
function to read lines of arbitrary length from the command line,
using malloc() and realloc() to allocate the necessary memory to
hold the lines. I came up with this:

Instead of all that just get ggets.zip from:

<http://cbfalconer.home.att.net/download/ggets.zip>

and read ggets.c (less code that yours, all standard). Then decide
if you want to use it (I have put it in the public domain) or adapt
it to your purposes.

--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.

** Posted from http://www.teranews.com **
.



Relevant Pages

  • Re: malloc()/realloc() - have I got this right?
    ... I'm teaching myself C by working my way through Steve Summit's ... of the questions (assignment 6, exercise 7), you have to write a ...
    (comp.lang.c)
  • Re: Resource Leveling
    ... Thanks again for your response Steve. ... him in the View / Resource Sheet - and under Resource Availability inserted ... I've added Joe to the resource sheet and made him available for November ... change the assignment levels once you have set them. ...
    (microsoft.public.project)
  • Re: Assignment dates not moving with task dates
    ... There are some dependencies but as Steve has noted we are using project to ... apart from how the resource assignment loads are distorted by the assignment ... That's what drives ...
    (microsoft.public.project)
  • Re: Conference
    ... far as assignment is concerned. ... (at least in the wards I've lived in) ... If they prefer a smaller or larger VT route, ... Teaching is never "Done". ...
    (soc.religion.mormon)
  • Re: Is Michael Glasser being watched? - WAS- Re: Kernel Panic
    ... With Steve in my KF his desperation will only get more extreme. ... If anyone cares, I am currently teaching at one college, and will be ... do private tech support and tutoring... ... Sure, Snit... ...
    (comp.sys.mac.advocacy)