Xcode Signal 11

Program has exited due to signal 11 (SIGSEGV). As I understand it, this error comes from a problem allocating memory, or from memory leaks...I am somewhat new to c++...where do I find information on how to fix this problem?
here is the header file where the problem occurs:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
struct connectFlush {
	bool trueConnectFlush;
	bool connectFlush;
	int highCard;
	int trueHighCard;
	double odds[3];
}DetConnectFlush();

connectFlush DetConnectFlush(int c1, int c2, int f1, int f2, int f3, int trn, int rvr, int round, int f1SV, int f2SV, int f3SV, int trnSV, int rvrSV, int cardSV1, int cardSV2, int flushSuitVal, bool trueFlush)
{
	connectFlush infunc;
	infunc.connectFlush=false;
	infunc.trueConnectFlush=false;
	infunc.highCard=0; infunc.trueHighCard=0;
		
	int matchCount=0, lessMatchCount=0, m=0, subMatch=0,straightArr[10][5], straightNds[10][7], straight[10][5], ndsC[10][5];
	unsigned int i=0, j=0, n=0,  z=0, q=0, nds=0;
	
	for(i=0;i<3;i++){infunc.odds[i]=0;}
	int arr[8][2];
	for(i=0;i<8;i++) { for(j=0;j<2;j++) {arr[i][j]=0;}}
	arr[0][0]=c1; arr[0][1]=cardSV1; 
	arr[1][0]=c2; arr[1][1]=cardSV2; 
	arr[2][0]=f1; arr[2][1]=f1SV;
	arr[3][0]=f2; arr[3][1]=f2SV; 
	arr[4][0]=f3; arr[4][1]=f3SV; 
	arr[5][0]=trn; arr[5][1]=trnSV; 
	arr[6][0]=rvr; arr[6][1]=rvrSV;
	arr[7][0]=0; arr[7][1]=0;
	for(i=0;i<7;i++){if(arr[i][0]==14){arr[7][0]=1; arr[7][1]=arr[i][1];}}
	n=1; m=1;
	
	for(i=0;i<10;i++) {
		straightNds[i][6]=0;
		straightNds[i][5]=0;
		for(j=0;j<5;j++) {
			ndsC[i][j]=0;
			straight[i][j] = n;
			straightArr[i][j] = 0;
			straightNds[i][j] = 0;
			n++;
		}n=m+1; m++;
	}   
	for(i=0;i<10;i++) {
		for(j=0;j<5;j++) {
			for(n=0;n<8;n++) {
				if(arr[n][0]==straight[i][j] && arr[n][1]==flushSuitVal) {matchCount++; straightArr[i][j]=arr[n][0]; straight[i][j]=0;}
				for(m=0;m<7;m++) {for(z=m+1;z<8;z++) {if(arr[m][0]==arr[z][0] && arr[m][0]<=straight[i][4] && arr[m][0]>=straight[i][0] ){lessMatchCount++;}}}
				if(lessMatchCount==1){subMatch=1;} if(lessMatchCount==3){subMatch=2;}
				if((matchCount-subMatch)==5 ) {/*infunc.odds[2] = 1;*/ /*infunc.trueHighCard = straight[i][4];*/ cout << "STRAIGHT FLUSH DETECTED!" << endl; /*infunc.trueConnectFlush=true;*/ for(z=0;z<5;z++){cout << straightArr[i][z] << " ";}cout << endl; break;}				
			}
		}matchCount=0;
	}
	
	z=0;
	for(i=0;i<10;i++) {
		for(j=0;j<5;j++) {
			if(straightArr[i][0]!=0 && straightArr[i][j] == 0) {straightNds[i][j] = straightArr[i][0]+j; }
			if(straightArr[i][0]== 0) {straightNds[i][0] = straight[i][0];for(m=1;m<5;m++){ if(straightNds[i][0]+m != straightArr[i][m]){straightNds[i][m] = straightNds[i][0]+m;}} ndsC[i][z]=straightNds[i][j];z++;}
		}
	}
	z=0;
	for(i=0;i<10;i++) {
		for(j=0;j<5;j++) {
			
			if(straightNds[i][j]!=0) {nds++; ndsC[i][z]=straightNds[i][j]; z++;}
			straightNds[i][5]=nds;
			if(straightArr[i][j] == arr[0][0] || straightArr[i][j]==arr[1][0]){straightNds[i][6]=1;}
		}nds=0;z=0;
	}
	switch(round) {
		case 1:
			for(i=0;i<10;i++){ if(straightNds[i][5] > 0 && straightNds[i][5] < 3 && straightNds[i][6]==1) {/*infunc.connectFlush=true;*/ cout << "\nDETECTED POSSIBILITIES OF STRAIGHT FLUSH FOR PLAYER" << endl; break; } }
			q=0;
			for(i=0;i<10 && q<2;i++) {
				if(straightNds[i][5] < 3 && straightNds[i][5]!=0 && straightNds[i][6]==1) {/*infunc.highCard = straight[i][4];*/ cout << "Card(s) Needed: "; for(j=0;j<5;j++){if(straightNds[i][j]!=0){cout << straightNds[i][j] << " "; ndsC[i][q]=straightNds[i][j];q++;}}cout << endl; for(z=0;z<5;z++){cout << straightArr[i][z] << " ";}cout << endl; if(straightNds[i][5]==1){/*infunc.odds[0] = (1.0 / 47.0);*/ cout << "Odds Improving to Straight(by Turn): " << infunc.odds[0] << endl;} if(straightNds[i][5]==2){/*infunc.odds[1] = (1.0 / 47.0) * (1.0 / 46.0);*/ cout << "Odds Improving to Straight(by Turn): "<< infunc.odds[1] << endl;} cout << "\n" << endl;}q=0;
			}
			break;
		case 2:
			for(i=0;i<10;i++){ if(straightNds[i][5] > 0 && straightNds[i][5] < 2 && straightNds[i][6]==1) {/*infunc.connectFlush=true;*/ cout << "\nDETECTED POSSIBILITIES OF STRAIGHT FLUSH FOR PLAYER" << endl; break; } }
			q=0;
			for(i=0;i<10 && q<2;i++) {
				if(straightNds[i][5] < 2 && straightNds[i][5]!=0 && straightNds[i][6]==1) {/*infunc.highCard = straight[i][4];*/ cout << "Card(s) Needed: "; for(j=0;j<5;j++){if(straightNds[i][j]!=0){cout << straightNds[i][j] << " "; ndsC[i][q]=straightNds[i][j];q++;}}cout << endl; for(z=0;z<5;z++){cout << straightArr[i][z] << " ";}cout << endl; if(straightNds[i][5]==1){/*infunc.odds[0] = (1.0 / 46.0);*/ cout << "Odds Improving to Straight(by River): " << infunc.odds[0] << endl;} cout << "\n" << endl;}q=0;
			}
			break;
		default:
			break;
	}
	
	return infunc;
}
Topic archived. No new replies allowed.