When your heart stops beating you're not dead right away.
However when your heart stops beating you're on your way to death within a few minutes or even a few seconds because your heart supplies blood through your body and to your brain.
If your heart stops beating you have a chance of surviving if the heart is able to beat again soon.
So it's important to get medical attention soon and if you do feel like your heart is about to stop beating and you're about to have a heart attack then call 911 before it happens.
That way the paramedics can be on the way.
If your heart stops beating and the paramedics can get your heart beating again soon enough then you could still survive.
But when your heart stops beating your brain also loses oxygen so you can also suffer from brain damage that cannot be reversed.