linux中main引數傳遞

weixin_33866037發表於2018-07-11
#include<stdio.h> 
#include<string.h>

//argument count變元計數
//argument value變元值
int main(int argc,char **argv) //或 int main(int argc,char *argv[])
{
    int i,j;
    i = atoi(argv[1]);
    j = atoi(argv[2]);
    
    printf("the Program name is %s\n",argv[0]);
    
    printf("The command line has %d argument:\n",argc-1);
    
    printf("%d,%d\n",i,j);
    
    return 0;
}

相關文章