We analyzed the electronic structures of carbon-doped hexagonal boron nitride, focusing on the comparison with the corresponding π-conjugate hydrocarbon molecules and odd-number substitution by first principle calculation. The band gaps are about the half that of the HOMO-LUMO gaps of corresponding hydrocarbons, except for the cis-butadiene structure in which aromatic hexagonal ring formation is important. Odd number doping makes metallic materials with very different work functions, depending upon the difference in B and N numbers, and has an expected application as electrodes for flexible devices.