My application has potentially a huge number of arguments passed in and I want to avoid the memory of hit duplicating the arguments into a filtered list. I would like to fi
Empirically, functions such as GNU getopt() permute the argument list without causing problems. As @Tim says, as long as you play sensibly, you can manipulate the array of pointers, and even individual strings. Just don't overrun any of the implicit array boundaries.
Some libraries do this!
The initialization method provided by the glut opengl library (GlutInit) scans for glut related arguments, and clears them by moving the subsequent elements in argv
forward (moving the pointers, not the actual strings) and decrementing argc
2.1
glutInit glutInit is used to initialize the GLUT library.
Usage
void glutInit(int *argcp, char **argv);
argcp
A pointer to the program's unmodified argc variable from main. Upon return, the value pointed to by argcp will be updated, because glutInit extracts any command line options intended for the GLUT library.
argv
The program's unmodified argv variable from main. Like argcp, the data for argv will be updated because glutInit extracts any command line options understood by the GLUT library.