Register on the forum now to remove ALL ads + popups + get access to tons of hidden content for members only!

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: 58
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.
thevyakar is offline   Reply With Quote

Old 11-08-2017, 04:57 AM   #2
Lebar.123
Registered User
 
Join Date: Nov 2017
Posts: 124
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: 51
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-14-2017, 08:35 AM   #4
Faraone
Registered User
 
Join Date: Feb 2017
Location: Egypt
Posts: 1,353
Nice information, thank you for sharing
__________________

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.
|
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.
|
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.

---
Join our
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
, Invite people and
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
. Share your thoughts, moments and interesting.
Faraone is offline   Reply With Quote
Old 11-17-2017, 03:02 AM   #5
thevyakar
Registered User
 
Join Date: Nov 2017
Location: USA
Posts: 58
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.
thevyakar is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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 03:08 AM
A programming language that uses a visual representation thiennhientuoid HTML / DHTML 0 06-24-2016 01:24 AM
Language Learning Development Software Aadolf General Discussion 0 05-09-2016 04:00 AM
Official Language and National Language..? gunjanjain General Discussion 2 03-04-2015 10:04 PM
French Language. eigeehte Post your ad here 2 01-11-2012 05:37 AM


All times are GMT -7. The time now is 12:04 PM.


Powered by vBulletin Copyright © 2013 vBulletin Solutions, Inc.