-
Pointer Problem
Whenever I try to use this code to get a segment of a string, I get an Access Violation. ptrC is a pointer to a position in a char array, and it is within the declared bounds of the array.
Code:
temp = *ptrC;
*ptrC = '\0';
//do stuff...
*ptrC = temp;
-
I'm not sure I understand the question entirely, but be sure to remember that strings dont need to have the '&' sign in front of them to have there address accessed/passed.
Code:
int * pInt = &myInt;
char * pChar = myChar;
Does that help any? (Probably not, huh?)
-
substring copy problems? :)
You're dereferencing a null pointer perhaps.
Post more code though.
-
Or are you trying to modify a string literal? For example, this is wrong:
char *p = "Testing";
*p = 'B';