Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7511445
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T23:32:54+00:00 2026-05-29T23:32:54+00:00

I have read that calloc (malloc+init) will sometimes fail to init array with zero

  • 0

I have read that calloc (malloc+init) will sometimes fail to init array with zero bytes (but will still return pointer to a malloc’ed array). but in documentation it does not specify that it will return NULL, is there a way to be sure that array was initialized to zero (better then going over array), if not what is the advantage of calloc over malloc ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T23:32:57+00:00Added an answer on May 29, 2026 at 11:32 pm

    If calloc() returns a non-NULL pointer, the block of memory will be zero’ed.

    Unless you have a buggy library. In which case you should tread carefully. And maybe consider getting a new toolchain, fix the bug (most libraries come with source) or write your own version of calloc() on top of malloc() or something.

    I think that chances are that calloc() is going to be rock solid, unless you have an absolutely ancient, pre-standard compiler or maybe some compiler that’s targeting very, very small systems where they felt the need to cut corners (which I’d assume they will have documented).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have read that copying the data directory will work. But, that is a
I have read that you can do it, but would this really improve performance
I have read that dealloc for an object will be called, only if retain
I have read that after select we use column-names but I have found a
I have read that the following code snippet will result in a compiler error
I have read that recursive implementation of QuickSort will require O(log n) of additional
I have read that Win32 will not allow remote invocation of a process that
I have read that CTE are better than cursor. But I am unable to
I have read that in a case where a table has many columns, but
I have read that passing -c when running rails generate will add the new

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.