Changed CPP code to C.