Begin to rewrite with C

still compile error.