If another car is in danger of hitting you, you should:

Your horn should be used to warn other drivers or pedestrians in situations where they may not see you. For example, if you think another driver is about to hit you, you should sound your horn.
DMV Writen Test