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
Phoenix [80]
3 years ago
8

5. Write few lines of code that creates two arrays with malloc. Then write a statement that can create a memory leak. Discuss wh

y you think your code has a memory leak by drawing the status of the memory after you use malloc and the line of the code you claim that creates a memory leak.
Computers and Technology
1 answer:
Darina [25.2K]3 years ago
3 0

Answer:

 // function with memory leak  

void func_to_show_mem_leak()  {  

int *pointer;

pointer = malloc(10 * sizeof(int));

*(pointer+3) = 99;}  

 

// driver code  

int main()  

{  

    // Call the function  

   // to get the memory leak  

   func_to_show_mem_leak();  

     return 0;  }

Explanation:

Memory leakage occurs when programmers allocates memory by using new keyword and forgets to deallocate the memory by using delete() function or delete[] operator. One of the most memory leakage occurs by using wrong delete operator. The delete operator should be used to free a single allocated memory space, whereas the delete [] operator should be used to free an array of data values.

You might be interested in
Please I need help.
fredd [130]

Answer:

The answer is the "TO address"

Explanation:

i just took the test and got it right sooooooo

4 0
3 years ago
Select one of the wrong answer from question 1 and explain why it is ironic.
matrenka [14]
There are no questions
3 0
3 years ago
what is a massive online storage that allows for Access by any internet-connected device running web browser. use for Less priva
Paladinen [302]
I recommend Google Drive, it allows up to 15gb of free storage. You can access it anywhere since it is fromGoogle. Another one you can try is Dropbox which only allows up to 2gb.
8 0
3 years ago
The BCD number for decimal 473 is( ). a) 111011010; b) 010011110011; c) 010001110011; d)0010110110​
jek_recluse [69]

Answer:

001101000111 is the bcd no for 347

8 0
2 years ago
Which of the following is best known as a business network LinkedIn, Facebook, Twitter or Word Press?
Maslowich
The answer is LinkedIn.
 LinkedIn manage your personal identity. It also build and engage in your professional network. It access knowledge, insights and opportunities. It links people, skills and opportunities to create world largest crowd business creation system.

7 0
3 years ago
Other questions:
  • How does the discussion of “Luddites,” “Marx,” and “John Maynard Keynes” in paragraph 21 contribute to the development of the id
    7·1 answer
  • What was the first browser that allowed for graphics to be viewed on the web?
    14·2 answers
  • What part of a check is the LEAST important?
    14·2 answers
  • When a Python program is reading a file, the data is input as plain ASCII characters in a string. What is the following code doi
    15·1 answer
  • Which process centers the spreadsheet's content on the page?
    15·1 answer
  • (1) Output a menu of automotive services and the corresponding cost of each service. (2 pts)Ex:Davy's auto shop servicesOil chan
    9·1 answer
  • What is the decrypted binary
    9·1 answer
  • Which of these parts serves as the rear cross structure of a vehicle?
    12·1 answer
  • What is normalization?
    7·1 answer
  • Employing the use of a(n) <br> will help you manage a STEM project.
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!