Information

Author(s) Arthur van Stratum
Deadline No deadline
Submission limit No limitation
Category tags Level 1, S2, String

Tags

Sign in

[S2] Reading arguments

When you execute a C program, its function main() is called with, as parameters, the name of the program and the arguments after the executable's name.

The signature of the main() function must be the following :

int main(int argc, char **argv)

Write a complete C program containing a main. Your program should print one argument out of two (starting with the first), and return 0. Each argument shall be separated by a space, and the output shall be terminated by a new line just after the last argument printed (so without any additional space). This new line should be added even if you don't print any argument. Don't forget the required includes for your program.

Example :

./myProg a b c d e f g
a c e g