Atomic number refers to the proton number of the atom itself. Number of electrons in an atom (an atom that is not reacted with any other molecules / Just the atom alone), is the same as the number of protons, because each electron has 1 negative charge, and each proton 1 positive charge, where they cancel out on each other to become a neutral charge.
So, when atomic number is 6, proton number is also 6, and number of electrons will also be 6 in that atom.
Hope this helps! :)