it's your 4th amendment that protects your privacy. In it it states "no Warrants shall issue, but upon probable cause, supported by oath or affirmation, and particularly describing the place to be searched, & the person or things being seized" (had to memorize that for class), which basically says that Police need a warrant to search, but there are exceptions where they don't need a warrant.
in a car search, if they have probably cause, they can search your car, but you may tell an officer they can't search it. If you consent to one, they can search whatever they want.
Just basically understand the 4th amendment & probable cause. At school it's much different though. Search New Jersey vs TLO & Stafford vs Redding if it's anything school related or on school grounds.