Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我以为
func(char* ary, size_t length)
或者
func(char ary[], size_t length).
你怎么看 ?
两者是绝对等价的。数组在传递给函数时会衰减为指针。您可以使用任何一种。
如果它是空终止的字符串,那么就func(char* str)足够了,(否则你不会称它为字符串,称它为字符数组)
func(char* str)