且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

再次调用相同源的strncpy()失败

更新时间:2023-11-14 08:38:40

array-subscript-operator []

The array-subscript-operator [] has higher precedence then the dereferencing operator *.

所以您要更改

*a[3] = ...

成为

(*a)[3] = ...

b 相同。

已将编译器的警告级别设置得足够高,它应该已经对此发出警告。或至少告诉过您,它们是带有

Having set the compiler's warning level high enough, it should have warned you about this. Or at least told you that their is something fishy with

*a[3] = '\0';