#include<stdio.h>

/*
 *  int ac 是命令行参数的个数 第一个参数是当前文件地址
 *  char * arg[]  字符指针的数组, 每一个指针指向一个具体的命令行参数(字符串))
 */

 //命令: ./test.out 1

int main(int ac,char * arg[])
{
    //printf("%d",ac);   //2 
    
    for (int i=0;i<ac;i++)
    {
        printf("%s\n",arg[i]);
        /*
        ./test.out
        4
        */
        
    }

}

 

相关文章:

  • 2021-08-27
  • 2021-12-20
  • 2021-07-01
  • 2022-01-14
  • 2022-01-11
  • 2021-11-25
猜你喜欢
  • 2021-08-17
  • 2022-12-23
  • 2022-12-23
  • 2021-12-26
  • 2022-01-05
相关资源
相似解决方案