Is there any limitation on string length defined in variable argument list

前端 未结 3 761
温柔的废话
温柔的废话 2021-01-26 00:11

I have doubt regarding variable argument list,is there any limitation on the lenght of char string defined as one of argument to variable list.for example

void S         


        
3条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-26 00:54

    There is no limit imposed by the C language on how long a C string can be (as C strings are basically arrays of char with a NUL character at the end). As you can see, the type of the argument is char *, i.e., pointer to char. This means that the string itself is not passed as an argument, but rather a pointer to its first character—the length of the string is therefore irrelevant for the function call.

    (In practice there will of course be a limit from the computer architecture and platform, but these limits are very high compared to typical string arguments.)

提交回复
热议问题