folding for c