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 22:30
The qwerty keyboard is the most common layout of keys on a keyboard
Answers: 3
question
Computers and Technology, 24.06.2019 01:30
Suppose a cpu with a write-through, write-allocate cache achieves a cpi of 2. what are the read and write bandwidths (measured by bytes per cycle) between ram and the cache? (assume each miss generates a request for one block.)
Answers: 1
question
Computers and Technology, 24.06.2019 12:00
How can we take picture in this app
Answers: 1
question
Computers and Technology, 24.06.2019 14:30
When workers demonstrate patience, are able to manage there emotions, and get along with other employees, which skills are being displayed?
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
English, 21.02.2020 04:33
question
Social Studies, 21.02.2020 04:33
question
Mathematics, 21.02.2020 04:33