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, 2910👍, 0💬
Popular Posts:
How can you determine the size of an allocated portion of memory? You can't, really. free() can , bu...
Explain all parts of a deployment diagram? Package: It logically groups element of a UML model. Node...
What are unadjusted function points and how is it calculated? Unadjusted function points = ILF + EIF...
How To Export Data to an XML File? - Oracle DBA FAQ - Introduction to Oracle SQL Developer If you wa...
Explain in detail the fundamental of connection pooling? When a connection is opened first time a co...