Answered step by step
Verified Expert Solution
Question
1 Approved Answer
struct T { int *a; struct T* next; }; int *y; int **z; struct T x; struct T* p1; struct T* p2; struct T** p3;
struct T { int *a; struct T* next; }; int *y; int **z; struct T x; struct T* p1; struct T* p2; struct T** p3; int main() { p1 = (struct T*) malloc(sizeof(struct T)); p2 = &x ; y = (int *) malloc(sizeof(int)); { int* a[3]; a[1] = (int *) malloc(sizeof(int)); z = &a[1]; x.a = *z; // point 1 (*p1).a = *z; // point 2 } (*p1).next = p1; // point 3 p2 = p1; // point 4 p3 = &p1; // point 5 p3 = *(&p3) ; // point 6 p3 = &(*p3) ; // point 7 x.a = y ; // point 8 z = x.a ; // point 9 free(x.a) // point 10 }
Find the locations that are garbage are ?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started