Concrete slab at a brick wall
You can leave a gap of a about 3-4 inches (70-100 mm).

Fill the gap with gravel - you can go from coarse to fine as you go. This will ensure that there is a route for any water to drain away. If there is a lot of water you may want to go as far as installing a French Drain which has a pipe for removing the water rather than relying on percolation.

Another route is to make sure that there is a slight slope away from the wall.