finish C version