Filing for bankruptcy help!!

I need some advice I’m 24 with about 45k in debit. I’m thinking about filing for bankruptcy because I just can’t catch up. what is the pro and cons about it. How exactly does it work? I’m definitely wanting to buy a house within the next few years but I’m not sure how everything will play out good advice will be wonderful. Thanks I’m advance.