C example is working fine