If an officer asks you if he or she can search your vehicle your answer should always be no. An officer may ask you at any time if they can search you or any of your other property including vehicles but they key is that you have the right to say no. Even if you do grant an officer permission to search you have the right to the officer where he or she may search and you can revoke that consent at any time during the search.
If an officer wants to search your vehicle, generally he or she will make various statements to you to try to get your consent. Commonly he or she may try to make it a general request by something like “I have a certain amount of vehicles I have to search every month and I don’t think you are a criminal or anything, would you mind if I have a quick look?” Another common question would be something along the lines of “You don’t have any dead bodies, machine guns, bombs, or anything like that in your car do you?” Most people of course do not, so the tactic is that listing items such as these the driver will believe that is what the officer is searching for and will give consent.
No matter what an officer tries to tell you to get consent to search always say no. If an officer has probable cause to search the officer will not ask you for permission but rather will tell you that he has probable cause to search or has a warrant and will do so. Of course in this case you must let the officer search. If the officer is asking your permission to search then you have every right to say no.