These all are isoelectronic species. Greater the nuclear charge stronger is the attraction for same number of electrons and smaller is the ion. Thus, nuclear charge on C4+,N3− and O2−, is 6,7 and 8 respectively but nuclear charge on Mg2+ is 12.
Hence, C4− has larger ionic radius than N3−,O2− and Mg2+.