// Illustrate how command line arguments are stored #include #include // Could also declare as: char **argv int main(int argc, char *argv[]) { // Print the value and address of argv printf("argv has value %x, storage at %x\n\n", *argv, argv); // Loop through command line arguments for (int i = 0; i < argc; ++i) { // Print the address of argv[i] printf("argv[%d] has address %x", i, &argv[i]); // Print the value of argv[i] printf(", value %x", argv[i]); // Print the contents of the argument (as character) printf(", contents of value is '%c'\n", *argv[i]); // Print the contents of the argument as a string printf("argv[%d] as string: <%s>\n", i, argv[i]); // And start a new line printf("\n"); } }