implementing in c