17.06.2017, 16:54
(
Last edited by fiha4155; 17/06/2017 at 06:12 PM.
)
@Vince, how do you know if it represents a starting point or a single character? And also why do we use something like idx in strtok, strrest functions? You create new variable named idx with no value, use it as a &index in those functions. What does & mean before &index? If idx doesn't have a value then why we need to use it? I say it has no value because;
As you can see, after creating it, you set no value to it. You use directly in strtok function.
btw, info of strtok:
So if it finds the value after space and returns it, why do you need an additional second argument like idx? Let me explain what I say.
splitted must be "world I am trying to understand pawn." because strtok found the thing after the space and returned it. Am I wrong?
I would be really happy if you answer all of these.
Code:
new cmd[128], idx; cmd = strtok(cmdtext, idx);
btw, info of strtok:
Quote:
This (strtok) is used to search a string and find a variable typed after a " " (space), then return it as a string. |
Code:
new string[128], splitted[128] ; string = "Hello world I am trying to understand pawn." splitted = strtok(string,[IDK WHAT TO PUT HERE, IN MY VIEW YOU DONT NEED TO PUT SOMETHING])
I would be really happy if you answer all of these.