Why for local variables the memory required to hold the
variable is allocated from the program stack and for new
its allocated from the heap?
Answer / achal ubbott
* Stack is a kind of data structure where Last In FirstOut
work. Local variables are needed for a short span of time
for immediate processing. So push and pop from stack is
used for them. Now memory is allocated to them in static
time only.
* new() operator allocates memory dynamically. Since
objects are needed for more time, space is taken from heap.
| Is This Answer Correct ? | 2 Yes | 0 No |
Why can you not make a constructor as const?
Which is better turbo c++ or dev c++?
Describe the main characteristics of static functions?
What is const pointer and const reference?
Please explain the reference variable in c++?
What is a container class? What are the types of container classes?
How should runtime errors be handled in c++?
How do I run a program in notepad ++?
what is data abstraction in C++?
What are the extraction and insertion operators in c++?
What is the use of map in c++?
Problem 5: Hero's Formula is A method for calculating the area of a triangle when you know the lengths of all three sides. Let a, b, c be the lengths of the sides of a triangle. The area is given by:A= pp-ap-b(p-c) | wherep= a+b+c2 | | Write a C-language code to calculate area of triangle using above method. Take the three lengths of the triangle from the user and display the area that your program calculates.