Command line arguments in C

前端 未结 6 1742
时光说笑
时光说笑 2020-12-21 01:35

I have this program execute with the values 10,20,30 given at command line.

int main(int argc , char **argv)
 { 
  printf(\"\\n Printing the arguments of a         


        
6条回答
  •  余生分开走
    2020-12-21 02:26

    Because you're printing out argv[4], argv[3], argv[2], argv[1], argv[0], instead of argv[3], argv[2], argv[1], argv[0].

    Basically you've got an off by one error.

提交回复
热议问题