1.The causative factors may be the same for both eg. hypertension and/or atherosclerosis
2.A heart attack may give rise to a stroke eg. through a drop in blood pressure as occurs in cardiogenic shock
3.A cerebral stroke
can trigger a heart attack through several pathways.
Hope this answers your question.