At present the tenancy is a joint one - A & B. B is moving out but so long as the tenancy does not change he is still a tenant and still has the rights and responsibilities of one (including responsibility to pay the rent if A does not pay it, and joint responsibility for dilapidations - which the deposit is to cover). Therefore so long as his name is on the tenancy there is no basis for him to have his deposit back.
If his name is removed, then there is a new tenancy with A as the sole tenant, or with A & C as joint tenants. As I see it, this is an entirely new contract and it is irrelevant that A is a tenant on both. The old tenancy has come to an end. A & B should both have their deposit back; an inventory should be done and any dilapidations paid for out of the deposit; A (or A & C) should pay a new deposit for the new tenancy.