what happens to their shares if person C wishes to buy shares.
From who? If a company has only two shares, then one of those two shares must be sold to C.
Now if A and B decide, as the majority owners, they they want to issue more shares so that they can sell some to C, then they can do that, but then one of them will have to give up some of their ownership.
Note that at this level, the number of shares is largely irrelevant. The discussion revolves more around what percentage of the company is being sold, and the number of shares simply reflect that. Meaning, A and B could issue 1 billion shares, and each share would have a value of 1 billionth of the "value" of the company (however anyone buying the shares wants to calculate that). If C wanted to buy 10% of the company (again, from either A or B), he would need to buy 100 million shares.
You seem to think that shares can be created out of thin air. This is not true. A company issues a specific amount of shares that are then traded among willing buyers and sellers in the open market. If C wants to buy shares of a company, then there must be someone else willing to sell them.