In a carbon dioxide molecule, the central carbon atom is surrounded by two areas of electron density. These are the bonds to the oxygen molecules. These areas of electron density are negatively charged and repel each other to the furthest possible distance, 180 degrees. This makes CO2 a linear molecule. In SO2 the central sulfur atom is surrounded by three areas of electron density, two bonding, one lone pair. These areas also repel the bonds to the maximum distance apart, which is in this case 120 degrees. SO2 is hence a triganal planar molecule.