Borrowing a String
A better solution to the above problem is to modify greet
to take a reference.
Exercise Get rid of the .clone()
method call, and modify greet
to accept a &String
parameter. Then fix the calls to the greet
function in main
.
Get hands-on with 1400+ tech skills courses.