What will happen if I allocate memory using "new" and free
it using "free" or allocate sing "calloc" and free it using
"delete"?
Answers were Sorted based on User's Feedback
Answer / sanjay makwana, puna
When you allocate a memory using new then constructor will
be called but when use a free that time destructor will not
be called.
Same vice versa for calloc and delete.
| Is This Answer Correct ? | 6 Yes | 0 No |
Answer / ekta
free is not compatible with new.
free wont recognise the memory allocated by new and should
gie some error i guess.
| Is This Answer Correct ? | 0 Yes | 1 No |
Answer / roshan p.r.
Hi,
you cannot free a memory allocated with new using "free"
and in the same way callac with "delete"
because they are incompatable
| Is This Answer Correct ? | 0 Yes | 6 No |
What is c++ hiding?
Const char *p , char const *p What is the difference between the above two?
I want explanation for this assignment: how to connect mysql database using c/c++,please explain this detailly?
Is c++ the best programming language?
wrong statement about c++ a)code removably b)encapsulation of data and code c)program easy maintenance d)program runs faster
What is ios :: in in c++?
What doescout<<(0==0) print out a) 0 b) 1 c) Compiler error: Lvalue required
What happens if a pointer is deleted twice?
Any one help me plzzzz..... i have an assignment...... that is ______*********_______ Write a program that takes an equation as a string and does the following: Solve 8 parts to achieve 100% 1 - 5 are compulsory. Input: 2x^2+3x+4=0 1) read a quadratic equation 2) print its coefficients (coefficients range is 0 to 9) 3) print the solution of the equation 4) tackle imaginary solution e.g. ( (2+3i), (2-3i) ) 5) allow spaces within the input 6) after solving one equation; ask for an other, terminate on empty line. * 7) tackle negative values as well * 8) tackle more than one values of same exponent (e.g. 2x^2 + 3x^2 + 4x + 3 = 0)* 9) use strtok * 10) print the solution in fractions e.g. 1.5 should be printed as (1)1/2 * 11) coefficient can be greater than 9** 12) values on both sides of the ‘=’ sign** 13) plot the graph of the polynomial** 14) use a compiler other than Borland** 15) submit before May 25, 2009 11:59 PM ** _______******________ plz send me c++ code at sweety.alvi@gmail.com
Can the creation of operator** is allowed to perform the to-the-power-of operations?
How can you link a c program with a c function?
A milk carton can hold 3.78 litres of milk. Each morning, a dairy farm ships cartons of milk to a local grocery store. The cost of producing one litre of milk is $0.38, and the profit of each carton of milk is $0.27. Write a C++ program that prompts the user to enter the total amount of milk produced in the morning. Then display the number of milk cartons needed to hold milk, the cost of producing milk, and the profit for producing milk.