Dayrvia
C

C · Object lifetime · Practice questions

Try 2 questions on C · Object lifetime, then read the explanations and review the related concepts.

Practice questions

Choose an answer and move to the next question. Grade the last one to see explanations and review links.

2 questions
Q1 What should be checked before writing through p?
int *p = malloc(sizeof *p);
Q2 Assuming p owned a successful allocation, how should alias be treated?
int *alias = p;
free(p);
p = NULL;
Original practice questions written for Dayrvia.