Home > Back-end > C language programming online segment error is how to return a responsibility
C language programming online segment error is how to return a responsibility
Time:10-07
Operation result is correct, no array subscript crossing the line, but is always wrong
CodePudding user response:
Post code and title
CodePudding user response:
May be caused by array is too big, such as: Int a, [10000000000].
CodePudding user response:
#include #include #include
Int main () { Char nums [60]. Char index [30]. int j=0;//j digital length Int k=0;//integer array counter int temp; Int answers [30];//final answer
Int m=0; Gets (nums); for(int i=0; i<59 & amp; & Nums [I]!='\ 0'; I++ j++) { M=0; If (nums [I]==' ') { for(; M{ The index [m]=nums (I - j + m), } The index [m]='\ 0';
Temp=atoi (index); Answers [k]=temp; K++;// J=1; }//if If (nums [I + 1)=='\ 0') { i=i+1; for(; M<=j; M++) { The index [m]=nums [I - j - 1 + m); } The index [m]='\ 0';
Temp=atoi (index); Answers [k]=temp; K++;
break; }//if }//for
For (int s=0; S{ If (answers [s + 1)==0) Answers [s]=answers [s + 1)=0; The else { Answers [s] *=answers [s + 1]; Answers [s + 1] --; } }//for
For (int s=0; S{ If (answers [s + 1]!=0 & amp; & Answers [s].=0) { If (s + 1==k) Printf (" % d % d ", answers [s], answers/s + 1); The else Printf (" % d % d ", answers [s], answers/s + 1); } The else { If (answers==0) [s + 1] {printf (" % d % d ", answers [s], answers/s + 1); break; } } }//for return 0; }