fix compile error and pass in a param
change to c99 std intead