这是我的问题: 我想缩短字符串,但在开头。例如,“string”应该是“tring”,或者“help”应该变成“elp”。 只需是第一个字母即可。
有什么想法吗? 谢谢! =)
最佳答案
要么
string++; /* Updates the pointer. */
或(假设字符串
位于可写内存中)
memmove(string, string+1, strlen(string)); /* Updates memory, including NUL character. */
关于C : How to shorten a string at the first letter,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27040313/