[comp.os.minix] malloc

RXS12@psuvm.psu.edu (08/03/90)

I might have missed discussion of this but:

   There seems to be something wrong with my malloc() call ... well ...
   is dosent give me anything when I do it ... i do something like this:

   struct stuff {
      char line[80]
   };

   struct stuff *np;

   np = (struct stuff *) malloc(sizeof(stuff));

   and ... when I try to put something in line the program gives me a
   "Memory Fault"  what is wrong?

Ron S.

crichmon@digi.lonestar.org (Charles Richmond) (08/10/90)

>   There seems to be something wrong with my malloc() call ... well ...
>   is dosent give me anything when I do it ... i do something like this:

.....

>   struct stuff *np;
>
>   np = (struct stuff *) malloc(sizeof(stuff));


The correct way to make this call is     malloc(sizeof(struct stuff))

                          instead of     malloc(sizeof(stuff))

See if this will fix your problem.


      Charles Richmond             crichmon@digi.lonestar.org