This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: problem with malloc/realloc. Pls help.


On 8/21/06, Omololu wrote:
Hi,
 i have the following code. it compiles with gcc in Cygwin but the contents of
the array ifitQ that I get after the call to the subroutine readCharges2 is
gibberish.

looks like a passing by reference problem. if you add debug to look at the address of ifitQ at all stages, you'll notice that the copy pointer in readCharges2 gets changed, but that isn't the same pointer as in the calling block.

see section 2.17 of http://www.lysator.liu.se/c/c-faq/c-2.html

i don't understand how linux is getting it right tbh.

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]