Original Post
Is it legal to modify a function parameter in C or C++?
I mean things like:
int func(int c, char * pString) {
c += 2;
char * p = "abcdef";
pString = p;
return strlen(pString);
}
I know this compiles and works on MSVC, but is it legal? (works on all compilers and OSes?) I''ve always done this before, it saves having to declare extra local variables sometimes - just use a parameter.
Always thought this was legal, but I was talking to another long time coder and he said it makes him nervous and that makes me nervous
I don''t want my code to blow up at some future point.