Look into the manual, there is already an example in the c_move chapter.