C Program to Print all Arguments passed using Command Line
C Program : Print All Arguments passed to C Program using Command Line.
1 2 3 4 5 6 7 8 | #include<stdio.h> int main(int args, char *argv[]) { int i = 0; for (i = 0; i < args; i++) printf("\n%s", argv[i]); return 0; } |
Output : Carry out following Steps to Run
- Save Program
- Compile Program.
- Run Program.
- Now Open Command Prompt.
- Move to the directory where program is saved.
- Type following command.
1 2 3 4 | C:>TC>BIN>pgm1 Pritesh Taral C:>TC>BIN>pgm1.exe Pritesh Taral |