clean up C/C++ codes

to avoid redundant variables