functional c code