sample code in c and c++