sizeof argv[1] not working

前端 未结 6 1649
南方客
南方客 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:29

    sizeof() returns the size of the type - ie the size of a pointer (probably 32bits) or a char (8bits)
    To get the length of a string you need strlen()

    Additionally in ansi C you can't create an array with a variable for the size. You can in the new C standard or for now you can use malloc() to create an array

提交回复
热议问题