Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C > Re: problem wit...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 10 of 11 Topic 26051 of 26821
Post > Topic >>

Re: problem with realloc

by Ulrich Eckhardt <doomster@[EMAIL PROTECTED] > May 13, 2008 at 03:10 PM

vippstar@[EMAIL PROTECTED]
 wrote:
> On May 4, 7:51 am, Barry Schwarz <schwa...@[EMAIL PROTECTED]
> wrote:
>> On Sat, 3 May 2008 09:33:17 -0700 (PDT), vipps...@[EMAIL PROTECTED]
 wrote:
>> >You most likely want something like this:
>> >  return calloc(0, sizeof book);
>>
>> book is a type.  The parentheses are required.  Other than the cast
>> and parentheses, your code is identical to the OP's.  Surely not your
>> intent.
> Yes you are right, thanks for pointing that out.
> return calloc(1, sizeof bp2);

Still wrong, bp2 is a pointer. You probably meant *bp2. However, that then
spoils the whole relation because it isn't used to initialise bp2. No, in
the elided original source, bp2 can well be removed completely, so using
sizeof (book) should work.

> `book' is confusing as a type. Maybe book_t or Book. Regardless, my
> mistake.

I beg to differ. I also don't need int_t or Integer. YMMV.

Uli
 




 11 Posts in Topic:
problem with realloc
Igal <igal.alkon@[EMAI  2008-05-03 09:21:19 
Re: problem with realloc
vippstar@[EMAIL PROTECTED  2008-05-03 09:33:17 
Re: problem with realloc
Barry Schwarz <schwarz  2008-05-03 21:51:53 
Re: problem with realloc
<brya103@[EMAIL PROTEC  2008-05-03 13:13:32 
Re: problem with realloc
Joe Wright <joewwright  2008-05-03 13:29:04 
Re: problem with realloc
Ulrich Eckhardt <dooms  2008-05-03 19:39:27 
Re: problem with realloc
Igal <igal.alkon@[EMAI  2008-05-03 16:53:18 
Re: problem with realloc
vippstar@[EMAIL PROTECTED  2008-05-03 17:00:05 
Re: problem with realloc
vippstar@[EMAIL PROTECTED  2008-05-04 04:42:39 
Re: problem with realloc
Ulrich Eckhardt <dooms  2008-05-13 15:10:48 
Re: problem with realloc
santosh <santosh.k83@[  2008-05-16 00:22:45 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed Jul 9 1:11:39 CDT 2008.