Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个 C 字符串,其值为 xxx,其中 x 可以是 1 到 9。什么是使它成为 xx8 的好算法,例如最后一位固定为 8。
我正在考虑使用 strtok 函数。
使用这个功能:
void mask_string(char s[]) { int j = 0,i; while (s[j] != '\0') j++; i = j-1; s[i] = '8'; }
即使您没有固定长度的字符串,这也有效