Command-Line Arguments
Command-line arguments allow you to pass arguments to a C program when it is executed from the command line. They provide flexibility and enable program behavior customization.
#include <stdio.h>
int main(int argc, char* argv[]) {
printf("Number of command-line arguments: %d\n", argc);
printf("Arguments:\n");
for (int i = 0; i < argc; i++) {
printf("%d: %s\n", i, argv[i]);
}
return 0;
}
No comments:
Post a Comment