Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


What is difference between new and malloc?

Answers were Sorted based on User's Feedback



What is difference between new and malloc?..

Answer / harsh

the difference between malloc and new is just that when a
variable is declared using malloc, it requires type casting
while new operator whenever used does not type cast by
itself as there is no need for the variable to be typecasted
when used with new operator

Is This Answer Correct ?    11 Yes 0 No

What is difference between new and malloc?..

Answer / shivi jain

new and delete are C++ specific features. They didn't exist in C. malloc is the old school C way to do things. Most of the time, you won't need to use it in C++.

malloc allocates uninitialized memory. The allocated memory has to be released with free.
calloc is like malloc but initializes the allocated memory with a constant (0). It needs to be freed with free.
new initializes the allocated memory by calling the constructor (if it's an object). Memory allocated with new should be released with delete (which in turn calls the destructor). It does not need you to manually specify the size you need and cast it to the appropriate type. Thus, it's more modern and less prone to errors.

Is This Answer Correct ?    7 Yes 0 No

What is difference between new and malloc?..

Answer / vivin

malloc is a dynamic memory allocation for pointers in C language. It stands for memory allocation. It is used to allocate continuous block of memory.

Is This Answer Correct ?    4 Yes 0 No

What is difference between new and malloc?..

Answer / vivin

new is a operator used for memory allocation in c++ & java

Is This Answer Correct ?    3 Yes 0 No

What is difference between new and malloc?..

Answer / devi

In C the malloc is used to allocate the memory space


In C++ the new operator is used to allocate the memory space

Is This Answer Correct ?    2 Yes 2 No

What is difference between new and malloc?..

Answer / amri

When we use macro its need typecasting but in new not need of typecasting.

new is a operator.

Is This Answer Correct ?    0 Yes 3 No

What is difference between new and malloc?..

Answer / sanjeevkumar.v

malloc --it mean memmory allocation .it will be.crete a
memory from a element



NEW--- newly crate a program are crete a memory allocation

Is This Answer Correct ?    1 Yes 10 No

Post New Answer

More OOPS Interview Questions

WHAT IS ABSTRUCT DATA TYPE ? PLEASE EXPLAIN IT.

4 Answers   HCL,


IN PROGRAMING LANGAUGE A C++ IS PURELY OBJECT ORIENTED OR NOT?

2 Answers  


What is Object and Class? What are the differences between them?

5 Answers  


What is the important feature of inheritance?

0 Answers   BPL,


What is virtual class and friend class?

5 Answers   IBS, Intel, Wipro,


i got a backdoor offer in process global,Bangalore..Can i work with it?

0 Answers  


can you explain how to use JavaBean in Project

3 Answers   Infosys, Satyam,


can you give real time example for polymarphism

5 Answers   TCS,


what is the use of template classes in c++

1 Answers  


What is object-oriented programming? Webopedia definition

0 Answers  


What is the oops and benefits of oops programming?

0 Answers  


#include <string.h> #include <stdio.h> #include <stdlib.h> #include<conio.h> void insert(char *items, int count); int main(void) { char s[255]; printf("Enter a string:"); gets(s); insert(s, strlen(s)); printf("The sorted string is: %s.\n", s); getch(); return 0; } void insert(char *items, int count) { register int a, b; char t; for(a=1; a < count; ++a) { t = items[a]; for(b=a-1; (b >= 0) && (t < items[b]); b--) items[b+1] = items[b]; items[b+1] = t; } } design an algorithm for Insertion Sort

0 Answers  


Categories