Go Back   Site Owners Forums - Webmaster Forums > Web Programming > Programming General

Notices


Reply
 
Thread Tools Rate Thread Display Modes
Old 11-08-2017, 02:13 AM   #1
thevyakar
Registered User
 
Join Date: Nov 2017
Location: USA
Posts: 75
C language

What is the difference between malloc() and calloc()?
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
thevyakar is offline   Reply With Quote

Old 11-08-2017, 04:57 AM   #2
Lebar.123
Registered User
 
Join Date: Nov 2017
Posts: 463
Basically there is no difference between the two besides calloc() zero-initializes the buffer, while malloc() leaves the memory uninitialized.
__________________
Get your email validated by our
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
@ ZeroBounce
Lebar.123 is offline   Reply With Quote
Old 11-14-2017, 06:47 AM   #3
nele
Registered User
 
Join Date: Aug 2013
Posts: 79
hi, thevyakar

There are two major differences between malloc and calloc in C programming language: first, in the number of arguments.

The malloc() takes a single argument, while calloc() takess two. Second, malloc() does not initialize the memory allocated, while calloc() initializes the allocated memory to ZERO.
__________________
"Powerfull state of the art DELL servers!"

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
- Ultimate Windows VPS hosting | Dedicated hardware MS Hyper-V technology Premium bandwidth providers

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
- Chat support Full 24/7 help desk support Email support
nele is offline   Reply With Quote
Old 11-17-2017, 03:02 AM   #4
thevyakar
Registered User
 
Join Date: Nov 2017
Location: USA
Posts: 75
Thank you all for your answers
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
thevyakar is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How perl language is differ from other programming language. ? Dubey675 Cgi-perl 0 10-21-2016 02:08 AM
A programming language that uses a visual representation thiennhientuoid HTML / DHTML 0 06-24-2016 12:24 AM
Language Learning Development Software Aadolf General Discussion 0 05-09-2016 03:00 AM
French Language. eigeehte Post your ad here 2 01-11-2012 05:37 AM


All times are GMT -7. The time now is 02:08 AM.


Powered by vBulletin Copyright © 2020 vBulletin Solutions, Inc.