1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
tensa zangetsu [6.8K]
4 years ago
15

Suppose that a function dynamically allocates a block of memory with a local pointer variable p pointing to the allocated block.

Suppose further that there are no other pointers referencing that block of memory, and the function returns without doing a delete on p. Then
A.
the pointer p becomes a dangling pointer.

B. the compiler will automatically deallocate the memory pointed to by p.

C. the program will suffer from memory leaks.

D. the returning function will throw the bad_alloc exception.

E. None of these
Computers and Technology
1 answer:
Kaylis [27]4 years ago
6 0

Answer:

The Pointer P becomes a dangling pointer.

Explanation:

int calculate(){

int *p = (int*)malloc(10);

*p = 10;

return p;

}

In this program, the scope of p is only with the calculate function block. Hence, once the compiler comes out of the function, it can no more access the pointer p or the memory location p is pointing to. To overcome the dangling pointer, we need to declare p as static, so that the scope of p is throughout the program.

You might be interested in
100 POINTS NEED ASAP PLEASE HELP
givi [52]

It is actually podcast! i took the quiz as well :)

3 0
3 years ago
Read 2 more answers
Complete the steps to evaluate the following
kirill115 [55]

Answer:

log base 3a= -0.631.log a/3 base 3

Now, -log m= log 1/m

hence,

log base 3a= 0.631.log 3/a base 3

log base 3a/log 3/a base 3 =0.631

log base 3 ( a.3/a) =.631 since, log m/logn =log n(m)

log base 3 3=0.631

Hence, answer is log base 3 3=0.631

Explanation:

Please check the answer section.

3 0
3 years ago
Read 2 more answers
What elements are needed in a workstation domain policy regarding use of antivirus and malicious software prevention tools?
Reika [66]
The server should be able to block unauthorized access, a good firewall but still, enable those authorized to have an access. However, there should be security on vulnerable parts of the system that may lead to corruption and easy access to data thieves.
3 0
3 years ago
Which of the following terms describes a type of useful and legitimate software that is distributed by a developer where they do
brilliants [131]

Answer:

freeware

Explanation:

a freeware is a software that is available free of charge but is not distributed with the source code.

6 0
3 years ago
How do you enlarge your screen if there is no control panel? Need desperate help!
igor_vitrenko [27]
You hit ctrl than the plus/equal sign Hope that helped! 
4 0
3 years ago
Other questions:
  • Define inheritance. give an example
    11·1 answer
  • During an experiment, if you purpose change the temperature to test a hypothesis the temperature is called what??
    6·1 answer
  • Web-based application software is software that ________.
    13·1 answer
  • How does an agile team maintain requirement?​
    9·2 answers
  • What is this line of code doing? scanf("%f", &height);
    6·1 answer
  • In risk management what does risk evaluation involved
    14·1 answer
  • Can you combine a wireless and wired lan in the same home
    14·1 answer
  • A newly opened law firm in Kirkland decides to create a small website that provides a brief introduction of the firm, its missio
    8·1 answer
  • An administrator is helping a user connect a smartphone to a tablet via Bluetooth. What should the administrator do first?
    6·1 answer
  • Type the correct answer in the box. Spell all words correctly.
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!