sizeof argv[1] not working

前端 未结 6 1693
南方客
南方客 2021-01-24 19:02

I\'m really new to C and all I know is that the error is related to oldname and newname not be initialized

#include 

in         


        
6条回答
  •  独厮守ぢ
    2021-01-24 19:36

    argv is of the type char*[], i.e., an array of pointers to char. Thus, any first level element will simply be a char* and, as such, sizeof(argv[i]) will always return the native pointer size. You need to use strlen or some equivalent function to get the length of the string.

提交回复
热议问题