9 lines
356 B
HTML
9 lines
356 B
HTML
<p>
|
|
Another example were you could allocate memory on the heap is the concatenation of two strings.
|
|
This has the advantage that you don't have to pass memory with the right size into the function.
|
|
The downside is, that you have to remember to free the memory when you don't need it anymore.
|
|
</p>
|
|
<p>
|
|
Implement the concat function with malloc.
|
|
</p>
|