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
padovan string for natural numbers program in java // aakash , suraj , prem sasi kumar kamaraj college program 1 : package test.padovanstring; public class Padov

write a pseudocode algorithm for a program that accepts a number and prints out its reciprocal(1/n) is required.the program should prevent the user from entering zero by asking t

C program to print L diagonal triangle: void main() {                 int i=0,j=0;                 int arr[rows][cols];                 for (i=0; i

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

hello i have about 15 hours the dead line I Need a program in c language that''s determine the router ip or the gateway ip of the current NIC example the router ip is: 192.168.1.1


Prepare a MT4 EA to clone MT4 Trades to a Binary Options Platform Project Description: I want an EA that clones MT4 Trades to Globaltrader365, GT Options and if possible othe

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.

Program for Memory Optimization of C / OpenCL Code Project Description: This is possibly a very simple project for someone with an excellent knowledge of C and OpenCL. That,

One person who is specialist at programming and solving problems with a computer Project Description: Dear Potential computer, hardware, programming and software genius, I