calloc and realloc

This is a discussion on calloc and realloc within the C Programming forums, part of the General Programming Boards category; Hey everyone, I'm using calloc to allocate memory and initialize each block in that memory to 0. If I call ...

  1. #1
    Registered User
    Join Date
    Nov 2010
    Posts
    3

    calloc and realloc

    Hey everyone,

    I'm using calloc to allocate memory and initialize each block in that memory to 0. If I call realloc sometime later to allocate more space, how can I make sure that all the blocks in the extra space are also initialized to 0?

  2. #2
    Registered User
    Join Date
    Jun 2005
    Posts
    6,815
    Look up memset().
    Right 98% of the time, and don't care about the other 3%.

    If I seem grumpy or unhelpful in reply to you, or tell you you need to demonstrate more effort before you can expect help, it is likely you deserve it. Suck it up, Buttercup, and read this, this, and this before posting again.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Trouble understanding Malloc, Calloc, and Realloc
    By matthayzon89 in forum C Programming
    Replies: 18
    Last Post: 10-19-2010, 12:20 AM
  2. malloc, realloc, calloc
    By newbie30 in forum C Programming
    Replies: 25
    Last Post: 08-13-2009, 01:14 PM
  3. Difference BW malloc() and calloc() and realloc()
    By svelmca in forum C Programming
    Replies: 2
    Last Post: 03-31-2009, 05:59 AM
  4. Realloc Quick Question.
    By killpoppop in forum C Programming
    Replies: 36
    Last Post: 01-13-2009, 12:04 PM
  5. We Got _DEBUG Errors
    By Tonto in forum Windows Programming
    Replies: 5
    Last Post: 12-22-2006, 04:45 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21