數組我不完全知道如何在C這樣做: char* curToken = strtok(string, ";");
//curToken = "ls -l" we will say
//I need a array of strings containing "ls", "-l", and NULL for execvp()
我怎麼會去這樣做呢?
可能重複: What is the difference between char s[] and char *s in C? Question about pointers and strings in C 我閱讀在C字符串和我很困惑。我可以用兩種方法「聲明」字符串: char *str = "This is string";
char str2[20] = "This is string";