It has recently been shown that a non-Hermitian Hamiltonian H possessing an unbroken PT symmetry (i) has a real spectrum that is bounded below, and (ii) defines a unitary theory of quantum mechanics with positive norm. The proof of unitarity requires a linear operator C, which was originally defined as a sum over the eigenfunctions of H. However, using this definition it is cumbersome to calculate C in quantum mechanics and impossible in quantum field theory. An alternative method is devised here for calculating C directly in terms of the operator dynamical variables of the quantum theory. This new method is general and applies to a variety of quantum mechanical systems having several degrees of freedom. More importantly, this method can be used to calculate the C operator in quantum field theory. The C operator is a new time-independent observable in PT-symmetric quantum field theory.