memset vs calloc

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Salvi
    New Member
    • Feb 2008
    • 9

    memset vs calloc

    Dear Friends,
    Can any one tell me the difference between memset and calloc function in C.

    Regards,
    Selvi
  • arnaudk
    Contributor
    • Sep 2007
    • 425

    #2
    calloc does memory allocation, memset does not.

    Comment

    • JosAH
      Recognized Expert MVP
      • Mar 2007
      • 11453

      #3
      The calloc function allocates memory and sets all of its bits to zero. The
      memset function sets n bytes of some memory (whether allocated, on the
      stack or whereever) to a certain value.

      kind regards,

      Jos

      Comment

      • Salvi
        New Member
        • Feb 2008
        • 9

        #4
        Originally posted by JosAH
        The calloc function allocates memory and sets all of its bits to zero. The
        memset function sets n bytes of some memory (whether allocated, on the
        stack or whereever) to a certain value.

        kind regards,

        Jos

        Thanks a lot.

        Regards,
        Selvi.

        Comment

        Working...