The company bankruptcy will be of two types. In the first case during the bankruptcy process also the company shares will be getting traded. The value of such shares may be very low. In such a case, you can sell your shares. In the other bankruptcy proceeding, the company stops all business and operations. A trustee will be appointed to sell the company's assets. He will be responsible to pay the creditors and investors as per the realisation. In such cases, there are usually very less assets left to pay shareholders, and the stock is generally of no worth.
In the first case, the company continues its daily operations. But all important decisions will be made by the trustee. The stock continues to trade. This usually has a significant impact on the stock's price. The stock may continue to trade over the counter. But no dividends are paid by the company.
In the second case, the company is going out of business. A trustee is appointed to close and sell off the assets. The assets are used to pay administrative expenses and then claims of secured creditors. The remaining asset recoveries will be distributed to interest holders. Bondholders and preferred shareholders as per the sequence. After all, these are over then comes the general shareholders. In many cases, there will not be anything remaining to pay for them and they will be the main losers.
These are the inherent risks involved in the stock market and the investor should be keenly following the trend and take the decision as required.