The Supreme Court has ruled on a number of cases involving Fourth Amendment rights and warrantless searches dealing with cars. In the most general of summary, an officer can conduct a search if he or she has probable cause to do so. 1
What's Probable Cause
Our Fourth Amendment says.... "The right of the people to be secure in their persons, houses, papers, and effects, against unreasonable searches and seizures, shall not be violated, and no Warrants shall issue, but upon probable cause, supported by Oath or affirmation, and particularly describing the place to be searched, and the persons or things to be seized." Our Supreme Court has ruled on a number of cases involving Fourth Amendment rights and warrantless searches dealing with cars. The Fourth Amendment of the Constitution, as it is generally understood, protects you from unreasonable search and seizure. You are presumed to be in possession of anything found in his car. This is federal law and does not vary from state to state. There may be something in your behavior, the way you are acting, your physical appearance in how you are handling yourself, or the physical appearance of your car that would prompt an officer to search.