题解 | #数组元素处理#
数组元素处理
https://www.nowcoder.com/practice/bb840c11be674d01b582847a6921d384
void func(int* p, int n) { // write your code here...... int tmp; for(int i = 0; i < n; ++i) { if(*(p + i) == 0){ tmp = *(p + i); for(int j = 0; j < n - 1; ++j){ *(p + i + j) = *(p + i + j + 1); } *(p + n - 1) = 0; } } }