Hydrogen can show both type of charges it means it can loose an electron or it can gain an electron. It depends that hydrogen is combining with which element like if is combining with metal then metal looses an electron and hydrogen gain an electron. Similarly if it is combining with electronegative element like fluorine then nonmetal gain electron and hydrogen has to loose an electron.