k-means clustering c code