About Me

My photo
Raipur, Chhattisgarh, India
Hi , I am Amit Thakur. I have worked as a QA Engineer for two years and as a Java Developer for one year in NIHILENT TECHNOLOGIES PVT. LTD., Pune.Currently I am working as DEAN (Research & Development) in Bhilai Institute of Technology, Raipur.

Tuesday, September 3, 2013

C Program to Print all Arguments passed using Command Line

#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

  1. Save Program
  2. Compile Program.
  3. Run Program.
  4. Now Open Command Prompt.
  5. Move to the directory where program is saved.
  6. Type following command.
C:>TC>BIN>pgm1 Amit Thakur
C:>TC>BIN>pgm1.exe
Amit
Thakur

No comments: