Caterpillars eat the leaves of trees and plants with flowers. They can become picky eaters and choose to eat only one type of leaf throughout their life. Caterpillars do not drink. Instead, they get hydrated by eating more leaves because the leaves also contain water.
Most insects are plant specific. Monarch Butterflies eat milk weed. Tent caterpillars eat alder. Pine caterpillars eat (of course) pine trees despite the obnoxious pitch. You question has to be more specific.