QQualcomm·DSASDE-2Onsite – Coding 2
Double Pointers: Modify a Pointer Via a Function
Problem
Explain and implement passing a double pointer so a function can change the caller's pointer (e.g., allocate and return a buffer, or delete a node).
Example
void alloc(char **out) { *out = malloc(64); }
Constraints
- Free correctly; avoid leaks/double-free
What Qualcomm looks for
Clear reasoning about pointer levels, heap ownership, and freeing memory for double pointers.
added 6 days ago