Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#include <stdio.h>
int main(int argc, char *argv[])
{
// create a program that outputs
// the name of the program,
// the first argument given and
// the last argument given.
printf("You are running the program \"%s\"\n", argv[0]);
printf("%i arguments have been passed\n", argc);
printf("the first argument is \"%s\"\n", argv[1]);
printf("the last argument is \"%s\"\n", argv[argc-1]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment