Ok I underatand how rack and pinion steering works but in order for it to prevent slippery in wheels the inner rotating wheel has to follow a different path with a different angle than the other one, so how does that happen though wheels are connected together with the same rack??
It's called an Ackermann steering mechanism. It is based on the Ackermann steering geometry principle.
If you look at the two diagrams, you'll see what's going on. The two steering arms are designed in such a way so the turning knuckle center point (point at which the wheel rotates on) and the tie rod end connection points, when a line is drawn through them, the intersection of the two lines meets at the rear differential (first drawing). Since both are at an angle, when you turn the wheel (left or right - doesn't matter), the inside tire is forced to turn more than the outside tire (second drawing). The design allows for the turning arc to intersect the axle plane no matter how far the turning rotation. By putting the intersection on the axle plane, you are also putting it on the turn center radius, which keeps the arcs of the two front tires proper as you go around a corner.
This is the theory, though it doesn't work out perfectly in real life. There will probably always be some deviance, but for the most part, this is the reason the inside tire will turn further than the outside tire. If you really want to get into the nuts/bolts, you can read this webpage. There is a lot of information about the mathematical theory behind the Ackermann steering mechanism.