Changed argument passing but it gives a weird output in the C code