int p_entity(char **data){
char *pch;
pch = strtok(*data, " \n");
// printf("%s ", pch);
pch = strtok(NULL, " \n");
// (*data) = (*data) + 1; // 1. this is okay
// (*data) = pch; // 2. but doing this will cause an error
printf("%c %d \n", *pch, pch);
printf("%c %d \n", **data, *data);
}
From the above code I will get the following if I uncomment 1:
g 4927479
e 4927456
I will get the following if I uncomment 2:
g 4927479
g 4927479
3 [main] main 8172 exception::handle: Exception: STATUS_ACCESS_VIOLATION
470 [main] main 8172 open_stackdumpfile: Dumping stack trace to main.exe.stackdump
Can anyone explain why I am getting that error? I would think both assignments would be legal and incrementing (*data) would be equivalent to straight assignning the address I want it to be at.
entity,data,pchfor "pointer to char" come straight from mindprod.com/jgloss/unmainnaming.html