[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [PROGRAMMERING] malloc ter sig underligt



Anders Søndergaard <sslug@sslug> writes:

> p = (int *) realloc(p,sizeof(int[i])); 

Hvis realloc ikke har plad umidelbart efter det allerede allokerede
hukommelse vil realloc begynde at flytte data og så returnere en
pointer der peger et andet sted han.

Men da du ikke kopierer den nye værdi af p tilbage fra find_numbers så
ved den kaldende funktion ikke at du har flyttet data.

Igen kan det løses med to lag pointere.

-- 
 Peter Makholm     |                            'Cause suicide is painless
 sslug@sslug |                             It brings on many changes
 http://hacking.dk |                And I can take or leave it if I please
                   |                                -- Suicide is painless


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 22:44 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *