Edited my post.
Printable View
Edited my post.
Looks correct. I suggest that you declare str to be a const char* for const-correctness.
Isn't the super const-correct form :
?Code:const char* const
That second const makes no difference to the caller and is effectively implementation detail.