postheadericon Example of command line argument in C on Linux


#include "stdio.h"
void main(int c, char *argv[])
    int i;
        printf("\nargument[%d] : %s",i,argv[i]);    

This code demonstrate how to use command line argument in c programming

To execute this code

  1. Open  Terminal
  2. Compile args.c
    • gcc -o args args.c
  3. Execute args.c
    • ./args hi this is a demo code


Follow by Email

Blog Archive

Total Pageviews

© Powered by Blogger.