Question: how nsdl and cdsl works?
Answer: The demat account is just an intermediary and it is actually CDSL and NSDL which hold your shares. So when you open a demat account to buy shares, the shares are held by the depositories. Another important function that depositories perform is when companies have to distribute dividends to its shareholders.