Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Which statement about the memory allocation is incorrect? 2. Which statement about dynamically array allocation is incorrect? Question 1 Which statement about the memory

1. Which statement about the memory allocation is incorrect?
2. Which statement about dynamically array allocation is incorrect?
image text in transcribed
Question 1 Which statement about the memory allocation is incorrect? Releasing memeber through the delete statement means the space occupied by the object is given back to the OS. All kinds of the arrays are allocated in the heap memory hence their size can be large. Automatic memory allocation are mostly introduced for function parameters and local variables; static memory allocation are carried out for the static and global variables, User program is responsible for allocating/releasing the dynamically allocated memory. Dynamic memory is allocated from the heap memory managed and the size is much larger than the stack memory, which are used for normal variables. Question 2 Which statement about dynamically array allocation is incorrect? Since the stack memory is limited, programmer usually need to allocate arrays in a dynamical way though the "new" keyword. Dynamically allocation of 2D array can be annoying, since it has to be kept as a pointer to pointer. After C++11 it is possible to initialize a dynamic array using the uniform initializing, The dynamical array is kept as a pointer, and it should be passed to the "delete/" statemenet before the end of the program. Null pointer is particularly useful since classically it indicates the allocated array has been initialized to zero

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intelligent Databases Technologies And Applications

Authors: Zongmin Ma

1st Edition

1599041219, 978-1599041216

More Books

Students also viewed these Databases questions