A search for supersymmetric partners of top quarks decaying as t˜1→cχ˜10 and supersymmetric partners of charm quarks decaying as c˜1→cχ˜10, where χ˜10 is the lightest neutralino, is presented. The search uses 36.1 fb−1pp collision data at a centre-of-mass energy of 13 TeV collected by the ATLAS experiment at the Large Hadron Collider and is performed in final states with jets identified as containing charm hadrons. Assuming a 100% branching ratio to cχ˜10, top and charm squarks with masses up to 850 GeV are excluded at 95% confidence level for a massless lightest neutralino. For mt˜1,c˜1−mχ˜10 < 100 GeV, top and charm squark masses up to 500 GeV are excluded.[Figure not available: see fulltext.].