Final answer:
If playing on the putting green and you hit another player's ball, there is no penalty and both balls are played as they lie, unless your ball moves significantly, in which case you must replace it. Outside the green, there is typically a two-stroke penalty.
Step-by-step explanation:
In the game of golf, if you are playing your ball on the putting green or within 20 yards of the hole and your ball strikes a fellow competitor's ball, the rules of golf apply to determine the outcome. According to the 2019 Rules of Golf, if your ball in motion accidentally hits another player's ball at rest on the putting green, you will incur no penalty, and both balls should be played as they lie unless your ball comes to rest in more than one club-length from where the original ball was, then your ball must be played as near as possible to where the original ball was. On the other hand, if you are playing outside of the putting green and this occurs, both you and the competitor will receive a two-stroke penalty unless local rules specify otherwise. It is always advisable to mark and lift your ball when it's on the green and there's a possibility it could interfere with another player's shot.