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
You’ve been tossed into an insane asylum. What do you tell the people there to prove to them that you don’t belong inside?
mars1129 [50]
Was this a question on an assignment or are you in an asylum right now
3 0
3 years ago
Read 2 more answers
Helppp pleaseee help pleaseee look at picture
ale4655 [162]

Answer:

C & E

Explanation:

Brainlest, Please!

4 0
1 year ago
Read 2 more answers
IVD. IIIcelTICISTUSTUSE LIICIULUI 1.12. Which of the two systems do you think will need the largest motor? Explain your answer.​
zhannawk [14.2K]
Transmission motor motor
8 0
3 years ago
What do you call a collection of pre-programmed commands and functions used in programs?
Keith_Richards [23]

Answer:

<h2><em>Heya</em><em> </em><em>Buddy</em><em>.</em><em>.</em></h2>

Explanation:

<em>A computer program is a collection of instructions that can be executed by a computer to perform a specific task. ... A collection of computer programs, libraries, and related data are referred to as software.</em>

<em>Hope</em><em> </em><em>that</em><em> </em><em>helps</em><em> </em><em>you</em><em> </em><em>dear</em><em>.</em><em>.</em>

<em>Bye</em><em>!</em>

6 0
3 years ago
If you click the increase font size button too many times and make the font size too big, you can click the ____ button until th
Anton [14]
Hey there! Hello!

I believe that you can click a button that has something to do with decreasing the font size, to go along with the question, perhaps the decrease font size button. Sometimes these buttons are represented with minus signs or arrows pointing downwards, among other symbols that convey that the font size will be decreasing.

I hope this helped you out! Feel free to ask me any additional questions if you have any. :-)
7 0
3 years ago
Other questions:
  • Ray has to type an invoice using the QWERTY keyboard. Along with letters and numbers, he also has to insert the dollar sign. Whi
    13·1 answer
  • You've been hired as a consultant to help an online store owner. You need to complete the implementation of conversion tracking
    5·1 answer
  • What pressure will be shown on the high side peessure gauge (ac system on)
    12·1 answer
  • How many generations of computer languages have there been since the middle of the 20th century?
    10·1 answer
  • The physical elements needed for the production of digital media, such as computers, servers, and so on are called the {Blank}
    8·1 answer
  • Select what's true about Search Engine Companies. Check All That Apply The information contained in a search engine database is
    12·1 answer
  • in java how do i Write a Java program that takes ten numbers as input to calculate and print the average of the numbers.
    11·1 answer
  • Programming Cycle. Arrange them in correct order​
    5·2 answers
  • Which block in this module represents the variable?
    8·1 answer
  • Which statement is true about biometrics as an authentication method?​
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!