Apple interview question

Implement some c library code