Command-line arguments in C
By: Jeffrey
This simple C program shows the method to accept and display command-line arguments.
#include <stdio.h>
int main(int argc, char *argv[])
{
int x;
// using for loop to iterate all the character...
for(x = 1; x < argc; x++)
printf("%s%s", argv[x],(x<argc-1) ? " ": "");
// go to a new line...
printf("\n");
return 0;
}
Archived Comments
Comment on this tutorial
- Data Science
- Android
- AJAX
- ASP.net
- C
- C++
- C#
- Cocoa
- Cloud Computing
- HTML5
- Java
- Javascript
- JSF
- JSP
- J2ME
- Java Beans
- EJB
- JDBC
- Linux
- Mac OS X
- iPhone
- MySQL
- Office 365
- Perl
- PHP
- Python
- Ruby
- VB.net
- Hibernate
- Struts
- SAP
- Trends
- Tech Reviews
- WebServices
- XML
- Certification
- Interview
categories
Related Tutorials
Sum of the elements of an array in C
Printing a simple histogram in C
Find square and square root for a given number in C
Simple arithmetic calculations in C
Passing double value to a function in C
Passing pointer to a function in C
Infix to Prefix And Postfix in C
while, do while and for loops in C