<>分> 这是大学的工作。 我并不期望守则能完成我的任务,而是想理解如何最好地操纵C的扼杀。
我需要书写某种功能,以某种方式操纵扼杀(我不说什么,以确保没有人提供准确的代码)。
In python I d just do the following
def foo(str):
return str
Clearly things aren t as easy as that in C.
Can anyone tell me how best to achieve this. Should I use pointers to simulate passing by reference and just manipulate the original string? Any help / resources would be greatly appreciated.
<>Update: 我确实想预示着这一行动的结果(也是一种扼杀)。 我很高兴地操纵原来的扼杀或归还。 以往将被视为最佳做法。
The task I ve been set is based on how to do that operation so I didn t want to make that explicit.
因此,沙尔将:
def foo(str):
#do something to str (which doesn t change it s length)
return str