memory allocations probs (continue)
Hi,
just wondering if I am allocation (totalsize) * (sizeof mystructarray), is it normal if it gives me segmentation fault when I am trying to access mystructarray[totalsize+1]?
just wondering whether I ve done my memory allocation right or wrong...
thanks,
Ferdinand
Re: memory allocations probs (continue)
Quote:
Originally posted by CyC|OpS
Hi,
just wondering if I am allocation (totalsize) * (sizeof mystructarray), is it normal if it gives me segmentation fault when I am trying to access mystructarray[totalsize+1]?
just wondering whether I ve done my memory allocation right or wrong...
thanks,
Ferdinand
when you allocate (totalsize * sizeof (mystruct)), you can legally access mystructarray[0] to mystructarray[totalsize-1], thats it.