...
Compliant Solution (Automatic Storage Duration)
When possible, use automatic Automatic storage duration can be used instead of dynamic storage duration. Since s
is not required to live beyond the scope of f()
, this compliant solution uses automatic storage duration to limit the lifetime of s
to the scope of f()
:
...