The electrons in an atom are arranged in energy levels or shells.
The lowest energy is in the shell which is nearest to the nucleus, negatively charged electrons are attracted to positively charged nucleus.
Each energy level holds a certain number of electrons, the first has the lowest energy levels holds two electrons. The second energy level is can have up to 8 electrons, when the second shell gets filled up, the third shell gets filled then fourthbegins to fill up.
This is a simple way of showing a carbon atom this can be shown as 2,4 this is called electronic structure of the atom