As stated, the number of protons in an atom defines that atom. Any atom with six is a carbon; any atom with seven protons is nitrogen. Thus, if a carbon atom gains a proton, it becomes a nitrogen atom. However, if a carbon atom gains or loses an electron, it still is a carbon, but now has a charge associated with it. The total number of protons and electrons defines the charge of an atom. An atom of any element with an equal number of protons and electrons will have a net neutral charge; atoms that have gained an electron will have a negative charge, and those that have lost an electron will have a positive charge. Most of the atoms of the elements on the periodic table can gain or lose one or more electrons. The numbers of neutrons within a given type of atom can also vary.
Atoms are made of electrons in orbitals around the nucleus where protons and neutrons are found. The identity of an atom is the number of protons. atoms that have the same number of protons but differ in the number of neutrons. Carbon 12 and carbon 13 both have six protons (thus they are carbon), but carbon 12 has six neutrons for a total atomic mass of 12, while carbon 13 has seven neutrons and when including the mass of the protons has an atomic mass of 13 (6 protons+ 7 neutrons=13 atomic mass). What about a compound or a molecule? How does a molecule differ from an atom or compound? A molecule is a substance of two or more atoms connected by sharing electrons (covalent bonds). A compound is a chemical substance made of different atoms.
Compounds can be made of atoms held together by ionic or covalent bonds where molecules are made only of covalently bonded atoms. Thus all molecules are compounds, but not all compounds are molecules. Molecules are often categorized further into organic (those molecules containing mostly carbon atoms) and inorganic molecules (everything else).