int size = 0;
int sorted[] = {};
int symbols[] = {8, 9, 13, 16, 16, 16, 17, 17, 17, 18, 18, 18, 20, 20, 27,
32, 33, 34, 35, 36, 37, 38, 39, 40, 44, 45, 46, 48, 48, 48, 49, 49, 49, 49,
50, 50, 50, 50, 51, 51, 51, 51, 52, 52, 52, 53, 53, 53, 54, 54, 54, 55, 55,
55, 56, 56, 56, 57, 57, 57, 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, 93, 112, 113,
114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 160, 161, 161, 162, 162,
163, 164, 164, 165, 186, 186, 186, 187, 187, 187, 188, 188, 188, 188, 189,
189, 189, 190};
int i = 0;
while(symbols[i] != 190){
size++;
if(symbols[i+1] == 190) {
size++;
}
i++;
}
int indx = 0;
for(int i = 0; i < size-1; i++) {
if(symbols[i] != symbols[i+1]) {
sorted[indx] = symbols[i];
indx++;
}
}
我找不到问题所在。什么可能导致未定义的行为?for 循环后的大小变量变为 27(应该是 123),我没有更改。完全迷失了,无法弄清楚问题出在哪里。