Categories:
.NET (357)
C (330)
C++ (183)
CSS (84)
DBA (2)
General (7)
HTML (4)
Java (574)
JavaScript (106)
JSP (66)
Oracle (114)
Perl (46)
Perl (1)
PHP (1)
PL/SQL (1)
RSS (51)
Software QA (13)
SQL Server (1)
Windows (1)
XHTML (173)
Other Resources:
You have two pairs: new() and delete() and another pair : alloc() and free(). Explain differences between eg. new() and malloc()
You have two pairs: new() and delete() and another pair : alloc() and free(). Explain differences between eg. new() and malloc()
✍: Guest
Answer1
1.) “new and delete” are preprocessors while “malloc() and free()” are functions. [we dont use brackets will calling new or delete].
2.) no need of allocate the memory while using “new” but in “malloc()” we have to use “sizeof()”.
3.) “new” will initlize the new memory to 0 but “malloc()” gives random value in the new alloted memory location [better to use calloc()]
Answer2
new() allocates continous space for the object instace
malloc() allocates distributed space.
new() is castless, meaning that allocates memory for this specific type,
malloc(), calloc() allocate space for void * that is cated to the specific class type pointer.
2012-02-06, 2767👍, 0💬
Popular Posts:
How To Control White Spaces between Table Cells? - XHTML 1.0 Tutorials - Understanding Tables and Ta...
How To Use SELECT Statement to Count the Number of Rows? - Oracle DBA FAQ - Understanding SQL SELECT...
What is difference between Association, Aggregation and Inheritance relationships? In object oriente...
When should the register modifier be used? Does it really help? The register modifier hints to the c...
Can you explain what is “AutoPostBack” feature in ASP.NET ? If we want the control to automatically ...