converted vidtst c++ to c