Structural and electronic properties of liquid carbon: ab initio molecular-dynamics simulation