Define difference among new & malloc?, C/C++ Programming

Both malloc & new functions are utilized for dynamic memory allocations & the basic difference is: malloc need a special "typecasting" while it allocates memory for eg. if the pointer utilized is the char pointer then after processor allocates memory then it allocated memory required to be typecasted to char pointer for example (char*).however new does not needs any typecasting. Also, free is the keyword utilized to free the memory whereas using malloc & delete the keyword to free memory whereas using new, or else it will lead the memory leak.


Posted Date: 3/16/2013 3:21:08 AM | Location : United States

Related Discussions:- Define difference among new & malloc?, Assignment Help, Ask Question on Define difference among new & malloc?, Get Answer, Expert's Help, Define difference among new & malloc? Discussions

Write discussion on Define difference among new & malloc?
Your posts are moderated
Related Questions
the program that solve the efficiency of otto cycle

Friend function in c++: class miles; class km  {    float value;    public :   // void input();     km convert(km  ,int a ) ;    void output()    {

Write a program to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b. The area under a curve betw

write a program in c/C++ using nested if statement for calculating the average marks and grades of 5 subjects

program to check whether a given point lies inside a rectangle or not

Write a c++ program to find the sum of 0.123 ? 103 and 0.456 ? 102 and write the result in three significant digits.

project on business management

Define the System Oriented Data Files? System-oriented data files are further closely related to the computer's operating system than Stream- oriented data files and they are s