This question already has an answer here:
I'm the farthest thing from a magic know it all, so I have a question for you. If my opponent has a 40/40 with trample and I have a 20/20 with lifelink that is blocking it. and I have 20 life left. Do I gain life from lifelink at the same time the damage is dealt to me? Thanks for taking the time to answer!