madasamy

RE: what is he difference between malloc and calloc

malloc is memory allocationcalloc is memory release

Is this answer useful? Yes | No

1

3

Overall Rating: -2

April 03, 2006 15:53:10

sanjay

RE: what is he difference between malloc and calloc 1:what is he difference between malloc and calloc

Is this answer useful? Yes | No

0

2

Overall Rating: -2

April 06, 2006 03:00:54

Rajeev

RE: what is he difference between malloc and calloc

Syntax
#include <stdlib.h> void *malloc (Size) void free (Pointer) void *realloc (Pointer Size) void *calloc (NumberOfElements ElementSize )
Size Specifies a number of bytes of memory. Pointer Points to the block of memory that was returned by the NumberOfElements Specifies the number malloc or calloc subroutines. The Pointer parameter points of elements in the to the first (lowest) byte address of the block. array. ElementSize Specifies the size of each element in the array.

Is this answer useful? Yes | No

May 02, 2006 05:30:31 parthiban_mcet

Member Since: May 2006

Contribution: 1

RE: what is he difference between malloc and calloc malloc is dynamic memory allocation it allocates the memory and initialize garbage value. calloc is similar to malloc but only difference is initialize zero

Is this answer useful? Yes | No

1

1

Overall Rating: -N/A-

July 08, 2006 04:58:36

2006 03:39:26 gunasekarnp Member Since: December 2006 Contribution: .e(calloc(no. 2006 03:59:47 sharmila RE: what is the difference between malloc and calloc malloc. Is this answer useful? Yes | No 2 0 Overall Rating: +2 December 09.of.rajesh kanna RE: what is the difference between malloc and calloc malloc .create the memory space calloc-calculate the memory space Is this answer useful? Yes | No 0 1 Overall Rating: -1 November 28.e(malloc(sizeof(int)*10) and allocate bytes of memory.take one argument i.var size of each var) and allocate block of memory. calloc-take two argument i.

2006 03:40:30 gunasekarnp Member Since: December 2006 Contribution: 2 RE: what is the difference between malloc and calloc reduce the memory size Is this answer useful? Yes | No 0 1 Overall Rating: -1 January 12. 2007 00:35:46 Sharath .2 c malloc used for memory reduce Is this answer useful? Yes | No 0 1 Overall Rating: -1 December 09.

3. calloc allocates memory which may/may not be contiguous. if a single contiguous block cannot be allocated then malloc would fail. all the memory blocks are initialized to 0. malloc takes only the size of the memory block to be allocated as input parameter. 4. malloc allocates memory as a single contiguous block. 1. 2007 13:28:49 fcawad_03 Member Since: October 2006 Contribution: 9 RE: what is the difference between malloc and calloc malloc::::: Allocates memory requests size of bytes and returns a pointer to the Ist byte of allocated space calloc:::::::: Allocates space for an array of elements initializes them to zero and returns a pointer to the memory Is this answer useful? Yes | No 1 0 Overall Rating: +1 Page 1 of 2 « Fir 1 2> st Last » I also faced this Question!! Ran Answer Posted By k .RE: what is the difference between malloc and calloc 1. Is this answer useful? Yes | No 2 0 Overall Rating: +2 February 16. calloc takes two parameters: the number of memory blocks and the size of each block of memory 2. 2. 3. it follows from point 2 that calloc will not fail if memory can beallocated in non-contiguous blocks when a single contiguous blockcannot be allocated.

# 2 It has some drawback like a global data is shared by all function and if in a large program it is find out difficult that which function uses which data. It is a concept or approach for designing a new software. On the other hand c++ is an object oriented programming language which eliminate some pitfall of conventional or procedural programming language. This is the main different between c and c++.Re: what is the main difference between c and c++? Answe c is not object oriented but c++ is 3 object oriented r #1 260 5 Yes Richa Is This Answer Correct ? 241 No Re: what is the main difference between c and c++? Answe Actually c is a procedural 3 programming language which r cann't face the real world problem. Rajeev Kumar Is This Answer Correct ? 178 6 Yes 227 No . It is nothing to do with any programming language although a programming language which support the oops concept to make it easier to implement.

jalgaon Is This Answer Correct ? Re: what is the main difference between c and c++? Answe In object oriented programming. What is an object? This topic is dealt with extensively in the chapter on ‘Objects and Classes’ but a brief introduction is provided here.h>as iclusion file.while in c++ we use cout<< as a output function.while in c++ r we use #include<iostreame>as # 4 inclusion file. All cars have some common features (for example all cars have four wheels. the 4 programmer can solve r problems by breaking them down into # 5 real-life objects (it presented the programmer with an opportunity to mirror real life). seats etc.like this for output 3 Chetna Chaudhari in c we use printf function. Is This Answer Correct ? 110 6 Yes 409 No Re: what is the main difference between c and c++? Answe in c we use #include<stdio. Bangalore . 871 Yes 490 No 2 Chetna Chaudhari. Are Sumit Gupta . Consider the category of cars.while r in c++ we use streame cin>> for # 3 input. an engine.Re: what is the main difference between c and c++? Answe in c we use scanf function as standard input function.). some body colour.

*C does not have classes and objects (C does not support OOP) *Structures in C cannot have functions. *C does not have reference variables (in C++ reference variables are used in functions). it would be useful to know the differences between C and C++. *C does not have namespaces (namespaces are used to avoid name collisions). *The I/O functions are entirely different in C and C++ (ex: printf( ). *Inline functions are not available in C. *Better dynamic memory management operators are available in C++.e. scanf( ) etc.all cars the same? Of course not. *You cannot overload a function in C (i. In this example cars will form a class and Ford (or Fiat) will be an object. Basically C++ includes everything present in C but the use of some C features is deprecated in C++. *In C constants are defined as macros (in C++ we can make use of ‘const’ to declare a constant). are part of the C language). For those people who know C programming. Is This Answer Correct ? 816 Yes 106 No Re: what is the main difference between c and c++? Answe c is a topdown approach while c++ is bottom up approach r 2 Ketan . A Fiat and a Ford aren’t the same but they are called as cars in general. you cannot have 2 functions with the same name in C).

that means in C also we # 8 have Object based 3 Jayasrinivas.Increase the effiency of the program and it gives extra security like Private data is also be there in C+ +.dona valli Applications like Structures and Unions. In otherwords we say c++ supports both Object based and Object oriented Applications Is This Answer Correct ? 449 Yes 104 No Re: what is the main difference between c and c++? .#6 Is This Answer Correct ? 821 Yes 142 No Re: what is the main difference between c and c++? Answe IN c-programe the main function could not return a value r but in the c++ the main function # 7 shuld return a value 381 Yes 587 No 2 Satyajith Srinivas Is This Answer Correct ? Re: what is the main difference between c and c++? Answe The main Difference between C and C++ is C is Object Based r program. Uses of Object oriented Program is Reusability. C++ is the Advanced version of C. C++ is Object Oriented Language that means entire application will be depending on Objects only.

.But in C++.r.Answe A function can be declared in C as 1 int fun(). this means that the function with no argument at all.sukumar Is This Answer Correct ? 385 Yes 62 No Re: what is the main difference between c and c++? Answe In C memory allocation is done with 2 malloc statement whereas r in C++ it is done through new # 11 keyword.Also memory is deallocated in C using free statement while in C++ deallocation takes place through delete. Krushna Priya Nath Is This Answer Correct ? 262 Yes 126 No Re: what is the main difference between c and c++? Answe The main difference between c and c++ is that " C is a r structured programming language # 10 while C++ is an object programming language and also we have templates in C++ that is not the case in C 1 K. Vivek Goyanr Is This Answer Correct ? 294 Yes 74 No Re: what is the main difference between c and c++? . This means r that fun()is a function without any # 9 argument or any number of arguments.

# 14 * C employs top down approach. but C++ 2 is a object oriented r language. but Rajendra Kumar Jena . 373 Yes 64 No 4 Uma Is This Answer Correct ? Re: what is the main difference between c and c++? Answe C r DATA IS NOT SECURED # 13 SECURED TOP DOWN BOTTOM-UP FOCUS ON PROCEDURES FOCUS ON DATA PROGRAMS ARE DECOMPOSED INTO OBJECTS INTO FUNCTIONS allocation is done NEW OPERATOR with malloc statement UNOINS AND ENUMS AVALIABLE ARE NOT AVALIABLE DOES NOT PROVIDE PROVIDES DEFAULT ARGUMENTS C++ 4 Mayuri Is This Answer Correct ? 584 Yes 86 No Re: what is the main difference between c and c++? Answe C is a procedural Language..Answe c++ support operator overloading but r c doesn't support operator # 12 overloading.

and are r much slower to compile than C # 15 programs. Is This Answer Correct ? 322 Yes 45 No Re: what is the main difference between c and c++? Answe C++ applications are generally slower at runtime. but in C++ data are secured from the outside world. and will probably continue to be used in projects where size and speed are primary concerns. Is This Answer Correct ? 166 Yes 58 No Re: what is the main difference between c and c++? . The low-level 2 Shaliza Garg infrastructure for C++ binary execution is also larger.c++ employes buttom up approach.h> as header file. and portable code still required (assembly would be unsuitable then). but in C++ we are using #include<iostream. * In C we are using #include<stdio. For these reasons C is always commonly used even if C++ has alot of popularity. * C give emphasis in algorithims and functions. but C++ give emphasis on the data and objects. * Here in C. the data are not secured from the outside world. when ever we are writing a program.h> as header file.

# 17 242 Yes 46 No 2 Dheeru Bhai Is This Answer Correct ? Re: what is the main difference between c and c++? Answe c is low level language while c++ is sn high level language.In c. Prakash Kumawat Is This Answer Correct ? 121 Yes 44 No Re: what is the main difference between c and c++? Answe c does not support the c++ programme but c++ support the c r program. r c++ is an extension of c language # 18 this means that you can use not only the new features of c+ + but can also use the c programing on that. the result of applying the operator size to a character constant.equalssize of (int).size of('c').Answe c is function or procedure oriented 2 whereas c++ is object r oriented.IN c++.inheritance and polymorphism.it focus primariy on tht # 16 actions and events and the programming model focuses on the logical assertions that trigger execution of programme code whereas c++is focusedon writingprogramas thet are more readable and maintainable and helps the reuse of code by packing a group of similar objects. C was THE C++ predecessor.returns size of(char). for example:. c++ is an object oriented while c is an program oriented in which you can make new softwares. 0 Ravi Pratap . A lot of c remains in c++.the expressionsize of('c').

2. r As its name implies. functions associated to it. and style among programmers will vary alot on the design choices made. which are somewhat similar to C structures. However.) C was the C++ predecessor. of various prototypes. Although not 3 Aashish Salotra actually being more powerful than C. some will prefer the handler-type. alot of # 19 C remains in C++.) In C. . somewhat like C functions often operate on a supplied handler pointer. where a main function initializes a handler. and that handler can be supplied to other functions of the library as an object to operate on/through. which can access and operate within the class. using an OOP (Object Oriented Programming) concept. to a class can be assigned methods. Others will even want to have that handler link all the related function pointers within it which then must be called using a convention closer to C++.) C++ allows the programmer to create classes.Is This Answer Correct ? 152 Yes 82 No Re: what is the main difference between c and c++? Answe DIFFERENCE b/w C and C++ 1. C++ aids to standardize a way in which objects are created and managed. C++ allows the programmer to more easily manage and operate with Objects. 3. 4. whereas the C programmer who implements the same system has alot of liberty on how to actually implement the internals.) Although it is possible to implement anything which C++ could implement in C.

In C++. 6.) In C. But in C++. however. 8. and will probably continue to be used in projects where size and speed are primary concerns.' at the end of main. it will be provided automatically but in C.) C++ support operator overloading but c doesn't support operator overloading. this means that the function with no argument at all. This means that fun( ) is a function without any argument or any number of arguments. 7.) C++ applications are generally slower at runtime. 9. you use the new[] operator. memory allocation for arrays is somewhat different than for single objects. Is This Answer Correct ? 165 Yes 30 No Re: what is the main difference between c and c++? .) A function can be declared in C as int fun( ).. For these reasons C is always commonly used even if C++ has alot of popularity.) In C++. and are much slower to compile than C programs. and you must match calls to new[] with calls to delete[] (rather than to delete). there's only one major memory allocation function: malloc. and portable code still required (assembly would be unsuitable then). You use it to allocate both single elements and arrays.5. you are free to leave off the statement 'return 0. The low-level infrastructure for C++ binary execution is also larger. you must manually add it.

C is a TOP->BOTTOM programming approch. 9.while c++ support all the features of C. C is a collection of FUNCTIONS. 3 Shaik Usman Ali Is This Answer Correct ? 139 Yes 39 No Re: what is the main difference between c and c++? Answe here are some difference between c and c++ --r 1.THIS IS THE # 20 FIRST AND FORE MOST DIFFERENCE BETWEEN THESE TWO LANGUAGES.DATA is HIDDEn. ->C++ is a BOTTOM->TOP programming approch. 4.DATA can be MOVE openly around in the system from function to function. c language main focuses on PROCEDURES. C is a LOW level language. ->C++ is a HIGH level language. We can do programming through STRUCTURE. 8. THIS IS THE MAJOR DIFFERENCE BETWEEN C AND C++ PROGRAMMING LANGUAGES. In C. -> C++ is a collection of FUNCTIONS and/or CLASS. -> c++ programming main focuses on OBJECTS.but NOT with the help of the CLASS.It can not be accessed by external functions.C can not support all the feature of the C++. -> In C++. C is a PROCEDURE oriented # 21 programming language. C NEEDS FORMAT CHARACTERS for printing & scanning. -> C++ DOES NOT REQUIRED FORMAT SPECIFIER for printing and 4 Daisy Golwala . 5. 7. THAT TO BE "++ OPERATOR OVERLOATING" IS DONE FIRST. 3. 6. -> We can do programming through CLASS in c++. -> C++ is a OBJECT oriented programming language. 2.Answe IN "C" WE CAN'T FOUND OPERATOR OVERLOADING CONCEPT WHERE AS r IN C++ IT IS POSSIBLE.

14. 16.you can NOT OVERLOAD a function.we use PRINTF() . -> C++ variables are DECLARED any where in the program.SCANF() as standard input/output functions.scanning variable. the MAIN() should NOT RETURN a value.we can use COUT<< or CIN>> as standard input/output function. 15. In C.MAIN() should RETURN a value. -> In C++. C variables are DECLARED in declaration section. -> In C++. In C.. -> In C++ . 17.REFERENCE variables are USED in functions. C does NOT have NAMESPACE for avoid name collisions. 10. -> In C++ . Is This Answer Correct ? 266 Yes 35 No Re: what is the main difference between c and c++? Answe C++ is object oriented language and 2 c is object based r language.In C program . -> We can make a use of 'CONST' TO declare a constant. C does NOT SUPPORT DEFAULT arguments. 12. -> C++ PROVIDES DEFAULT argument concept.C does NOT have REFERENCE variables.you can OVERLOAD the operator as well as functions. 13.constants are defined as 'MACROS'. 11. -> c++ has NAMESPACE feature. In C. # 22 173 Yes 73 No Luckyy Is This Answer Correct ? .

Re: what is the main difference between c and c++? Answe DIFFERENCE b/w C and C++ 1. In C++. 2. 5. whereas the C programmer who implements the same system has alot of liberty on how to actually implement the internals. 4. and that handler can be supplied to other functions of the library as an object to operate on/through. however. using an OOP (Object Oriented Programming) concept. 3. Others will even want to have that handler link all the related function pointers within it which then must be called using a convention closer to C++.) Although it is possible to implement anything which C++ could implement in C. However.) In C. You use it to allocate both single elements and arrays. Although not actually being more powerful than C. # 23 alot of 3 Rohit C remains in C++. of various prototypes.) C was the C++ predecessor. some will prefer the handler-type. C++ allows the programmer to more easily manage and operate with Objects. there's only one major memory allocation function: malloc. and style among programmers will vary alot on the design choices made. r As its name implies. functions associated to it. memory . C++ aids to standardize a way in which objects are created and managed.) C++ allows the programmer to create classes. to a class can be assigned methods. which are somewhat similar to C structures. which can access and operate within the class. somewhat like C functions often operate on a supplied handler pointer. where a main function initializes a handler.) In C.

you use the new[] operator.) In C++.allocation for arrays is somewhat different than for single objects. 9. and portable code still required (assembly would be unsuitable then). 7. by:.) A function can be declared in C as int fun( ). 6. this means that the function with no argument at all. and you must match calls to new[] with calls to delete[] (rather than to delete).ROHIT AGGARWAL PUNJAB Is This Answer Correct ? 140 Yes 24 No Re: what is the main difference between c and c++? . For these reasons C is always commonly used even if C++ has alot of popularity.) C++ support operator overloading but c doesn't support operator overloading. you must manually add it. But in C++.. 8. This means that fun( ) is a function without any argument or any number of arguments. it will be provided automatically but in C. and are much slower to compile than C programs. you are free to leave off the statement 'return 0. and will probably continue to be used in projects where size and speed are primary concerns.' at the end of main. The low-level infrastructure for C++ binary execution is also larger.) C++ applications are generally slower at runtime.

B and c++ comes after adding ++ in C r # 25 . The main function should return a value. Is This Answer Correct ? 132 Yes 27 No Re: what is the main difference between c and c++? Answe C comes after A. C++ gives importance to object that is data.kannigaarasu dont support c++ programme. It is 2 S.Answe C gives importance to procedure. The main function # 24 couldnot return a value. It is support c programme. That is functions rather r than data.