The number of protons in an atom determines its atomic number and also the number of electrons in a neutral atom. For example, carbon has an atomic number of 6, which means it has 6 protons and 6 electrons. This makes carbon a neutral atom, with a total charge of 0.
If an atom gains or loses electrons, it becomes an ion. An ion has a net positive or negative charge. For example, if carbon loses one electron, it becomes a carbon cation, with a charge of +1. If carbon gains one electron, it becomes a carbon anion, with a charge of -1.