Hi, I'm trying to write a simple program in VC++ 2010 to tokenize a sentence.
Yet, the code I wrote do not cause any compilation errors( regardless of warnings about strtok ) but when its executed it stops working. This is the code:
This program seems to have a problem with strtok() because of these:


And one another thing: why when I change
to
... it works correctly?
Yet, the code I wrote do not cause any compilation errors( regardless of warnings about strtok ) but when its executed it stops working. This is the code:
Code:
#include <iostream>
#include <cstring>
using namespace std;
int main(){
char *line = "int a = 10, b; ";
char *token;
token = strtok( line, " " );
cout << token;
return 0;
}


And one another thing: why when I change
Code:
char *line
Code:
char line[]
Comment