calloc allocates storage for a requested number of elements and initializes the bytes to zero. Always check for allocation failure before accessing the result. free releases allocated storage. This example uses a small fixed count; for external sizes also check arithmetic bounds.
Read the example
The complete program appears below. Read it first, predict the output, then run it.
Expected output
Values: 12 0
Practise
Store three values, print their sum and keep exactly one free call for the allocation.
Common mistake
Do not use freed memory or free the same allocation twice. Returning early after allocation can leak memory unless you release it first.