Inelastic collisions of argon and chlorine ions in carbon