P-trap location question?

Does the p-trap have to be directly under the the sink or with a home with crawl space can it be below the floor in the crawl?
I think not , but a plumber yesterday told me as long as it has one it is OK.

Maximum Distance

     According to the International Residential Code, the maximum vertical distance between the sink drain and the entrance to the p-trap is 24 inches. However, the Universal Plumbing Code stipulates that the total developed length of all tailpieces, arms and fittings connecting the drain to the p-trap must be 24 inches or less.

Thank! I thought it was something like that.