c command line arguments code example
Example 1: command line arguments in c
int main( int argc, char *argv[] )
./a.out kiran kumar gun
./a.out is arg[0]
kirna is arg[1]
Example 2: java command line arguments
class CommandLineExample{
public static void main(String args[]){
System.out.println("Your first argument is: "+args[0]);
}
}
compile by > javac CommandLineExample.java
run by > java CommandLineExample sonoo
Example 3: command line arguments in java
public class CommandLine {
public static void main(String args[]) {
for(int i = 0; i<args.length; i++) {
System.out.println("args[" + i + "]: " + args[i]);
}
}
}
Example 4: command line arguments c
int main(int argc, char* argv[]){}