所以,如果我在C以下的字符數組:刪除字符數組中的第一個令牌,並保持休息用C
"a b c" // where "a", "b", and "c" can be char arrays of any length and the
// space between them can be of any length
我如何刪除「」令牌,但存儲休息「BC 「在一個字符指針?
到目前爲止,我已經實現了不起作用下面的方法:
char* removeAFromABC(char* a, char* abc) {
char* abcWithoutA[MAXIMUM_LINE_LENGTH + 1];
int numberOfCharsInA = strlen(a);
strcpy(abcWithoutA, (abc + numberOfCharsInA));
return abcWithoutA;
}
怎麼樣:'字符* str_minus_sw =(your_array + 2);'? –
但問題是,「SW」不會永遠是第一個字符 –
代碼很簡單。 –