IHYPRESS.NET
C
HOME | ASP | C | CSS | HTML | JAVASCRIPT | PERL | PHP | PYTHON | RUBY | SVG
Earn Free Bitcoin
CAdvanced Programming ❯ String Command Line Arguments
<12.01>
/* Using command-line arguments */
#include <stdio.h> /* argc: number of arguments (always at least 1) */ /* argv: array of strings containg the arguments */ int main (int argc, char *argv[]) { int i; /* argument 0 identifies the program */ printf ("This program was called with \"%s\".\n",argv[0]); /* arguments from 1 are passed to the program */ /* displays the arguments as entered */ printf ("Arguments passed: "); for (i = 1; i < argc; ++i) printf("%s ", argv[i]); printf ("\n"); /* diaplays each idividual strings of arguments */ if (argc > 1) { for (i = 1; i < argc; ++i) printf("argv[%d] = %s\n", i, argv[i]); } else { printf("The command had no other arguments.\n"); } return (0); }
Hergestellt in Deutschland / Made in Germany
Microsoft(R) Windows DOS (C)Copyright Microsoft Corp 1990-2001. A:\> arg.exe the quick brown fox This program was called with "ARG.exe". Arguments passed: the quick brown fox argv[1] = the argv[2] = quick argv[3] = brown argv[4] = fox A:\>
COPYRIGHT © 2015-2024 IHYPRESS.NET. A DIVISION OF IHY PRESS. ALL RIGHTS RESERVED.