Many factors are considered.
Please use this dependent test from the IRS to determine qualification.
https://www.irs.gov/help/ita/whom-may-i-claim-as-a-dependent
This article will provide more information on dependents. https://ttlc.intuit.com/replies/6514582