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
Write 3 things that can't be done without technology.
bulgar [2K]

Answer:

Hacking Online Orders Math

Explanation:

4 0
3 years ago
Read 2 more answers
What can the tab key do
bulgar [2K]
Answer: it indents

Explanation:
8 0
3 years ago
Bob's Assembly is a hardware manufacturer. It specializes in builders' hardware for doors, cabinets, windows, and bathrooms. Bob
Snezhnost [94]

Answer:

distinctive competence

Explanation:

The distinctive competence denotes the various characteristic of certain business on which behalf that business perform better than its competitors. And since the business succeeds in doing those things better than its competitors, that business gains a competitive advantage over its competitors. And here, Bob's assembly is a hardware manufacturer for the doors, cabinets, windows and the bathrooms. And his assembly products are more durable and economical than its competitor's products. And thus Bob has a competitive advantage over its competitors.

3 0
4 years ago
State four input device that are used for playing gaming programs​
bekas [8.4K]

Answer:

Mouse, Keyboard, Headphones, Charger.

Explanation:

These can be plugged into the computer for gaming and other uses.

5 0
2 years ago
Read 2 more answers
NEED HELP PLEASE-
zysi [14]

Answer:i believe it is patents. i could be wrong

Explanation:

To protect your interests, consider two common strategies employed by inventors, amateur and professional alike. First, you can file a provisional patent application (if your invention is patent able)

5 0
3 years ago
Read 2 more answers
Other questions:
  • The following is true about SPAM ________.
    9·1 answer
  • NEED THIS NOW PLEASE!!!! (I AM NOT JOKING I HAVE TO SUBMIT IN 5 MINUTES)
    13·2 answers
  • An ethernet switch has a ____ table which is updated by ______.
    14·1 answer
  • Which CSS attribute would change an element's font color to blue? font-color: blue; background: blue; color: blue; background-co
    10·2 answers
  • What does f.i.r.s.t stand for in robotics
    15·1 answer
  • You are interested in buying a laptop computer. Your list of considerations include the computer's speed in processing data, its
    11·1 answer
  • How many constructors are there in the following class declaration?class CashRegister { public: CashRegister(); CashRegister(int
    8·1 answer
  • What are the characteristics of the sorting and grouping options in Outlook? Check all that apply. Columns can be sorted by clic
    15·2 answers
  • Which of the following statements is TRUE of a peer-to-peer network?
    10·1 answer
  • How does the use of blocking affect the external sorting algorithm, and how does it change the cost formula
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!