#include void crop(int num_strings, char** strings, int characters_cropped); int main(int argc, char** argv) { /* crop the first two letters of each input argument, * by jumping from index 0 to index 2 */ int jump_to_index = 2; /* crop all of the strings in argv, except the one with index 0; * note that argv[0] is always the program's name. * only the argv[i] with i > 0 are genuine command-line arguments. */ crop(argc-1, argv+1, jump_to_index); for(int i = 1; i < argc; i++) std::cout << "Argument no. " << i << " was cropped to \"" << argv[i] << "\".\n"; } /* implementation that "crops" a string by incrementing it, so that * it effectively begins characters further ahead. */ void crop(int num_strings, char** strings, int characters_cropped) { for(int i = 0; i < num_strings; i++) strings[i] += characters_cropped; } /* make and try executing: * ./wildptr ABCDE FGHIJ KLMNO * ./wildptr ABCDE FGHI JKL MN O */