Yes, Ditto can breed with any Pokémon as long as they're not in the No Egg Group. Pokémon in the No Egg can't breed at all with anything or anyone so you wouldn't be able to get Eggs of them except for special situations.
Basically Pokémon that are considered to be "Child Pokémon" cannot breed at all. Those are Pichu, Cleffa, Igglybuff, Smoochum, Tyrogue, Wynaut, Elekid, Magby, Azurill, Budew, Chingling, Bonsly, Happiny, Mantyke, Munchlax, Riolu and Mime Jr. Phione is also considered a Child Pokémon but Phione is an exception since it would be able to breed with Ditto but you'll only get Phione Eggs.
Also Pokémon in the No Egg Group can't breed either which other than the Child Pokémon which I've already included, the other Pokémon are Nidorina, Nidoqueen, Articuno, Zapdos, Moltres, Mewtwo, Ho-Oh, Lugia, Celebi, Entei, Suicune, Raikou, Regirock, Registeel, Regice, Regigigas, Groudon, Kyogre, Rayquaza, Latias, Latios, Jirachi, Deoxys, Unown, Azelf, Uxie, Mesprit, Dialga, Palkia, Giratina, Arceus, Darkrai, Shaymin, Heatran, Cresselia, Cobalion, Virizion, Terrakion, Victini, Thundurus, Tornadus, Zekrom, Reshiram, Landorus, Kyurem, Keldeo, Meloetta and Genesect.
Manaphy even though it's a Legendary, it cannot breed with anything other than a Ditto and all you'll get are Phione Eggs.
So yes breeding a Charmander with a Ditto will result in you receiving a Charmander Egg. Basically any Pokémon that breeds with Ditto, you'll get the lowest form of the Pokémon the Ditto is breeding with but that only counts depending on whether a Pokémon has an Incense item they can use or not.
Like for example, say you breed a Pikachu with a Ditto. You'll always get a Pichu Egg.
However say you're breeding a Wobbuffet with a Ditto. You'll always get a Wobbuffet Egg unless you give your Wobbuffet the Lax Incense then you'll get a Wynaut Egg.