A transferable empirical potential for carbon is developed by extending the environment-dependent interaction potential (EDIP) proposed for silicon. The current potential extends EDIP to describe carbon and addresses the most significant weakness of silicon EDIP, namely, the absence of \pi-bonding effects. With this improvement, essential phenomena such as dihedral rotation penalties and \pi-repulsion are described. Elastic constants agree well with the experiment, and simulations of liquid carbon compare very favorably with Car-Parrinello's calculations. Furthermore, amorphous networks generated by liquid quench have properties superior to those of the Tersoff, Brenner, and orthogonal tight-binding methods.