codes  from 《C Implement and 》