subject
Computers and Technology, 06.07.2021 15:20 lb31224

There is a memory management issue in the following main function. Please explain the memory management issues in this code and explain the reason behind this. int main()
{
char *p1 = malloc(20);
char *p2 = malloc(30);

strcpy(p1, "cat");
p2 = p1;

printf("%s", p1);

free(p1);
free(p2);

return 0;
}

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 14:30
Create a pseudocode design to prompt a student for their student id and the titles of the three classes they want to add. the solution should display the student’s id and a total bill. • bill a student using the following rules: o students can only add up to 3 classes at a time.
Answers: 3
question
Computers and Technology, 22.06.2019 22:40
In this lab, you complete a python program that calculates an employee's annual bonus. input is an employee's first name, last name, salary, and numeric performance rating. if the rating is 1, 2, or 3, the bonus rate used is .25, .15, or .1 respectively. if the rating is 4 or higher, the rate is 0. the employee bonus is calculated by multiplying the bonus rate by the annual salary.
Answers: 1
question
Computers and Technology, 23.06.2019 06:20
Which text function capitalizes the first letter in a string of text? question 10 options: upper capital first proper
Answers: 1
question
Computers and Technology, 24.06.2019 02:30
How to apply the fly in effect to objects on a slide
Answers: 1
You know the right answer?
There is a memory management issue in the following main function. Please explain the memory managem...
Questions
question
Mathematics, 28.09.2020 21:01
question
Chemistry, 28.09.2020 21:01
question
Mathematics, 28.09.2020 21:01
question
Mathematics, 28.09.2020 21:01
question
Chemistry, 28.09.2020 21:01
Questions on the website: 13722363