Why it is not allowed to pass arrays by value to a function in C and C++?

前端 未结 6 816
心在旅途
心在旅途 2020-12-30 10:24

C and C++ allows passing of structure and objects by value to function, although prevents passing arrays by values.

Why?

6条回答
  •  执念已碎
    2020-12-30 11:06

    I'm not actually aware of any languages that support passing naked arrays by value. To do so would not be particularly useful and would quickly chomp up the call stack.

    Edit: To downvoters - if you know better, please let us all know.

提交回复
热议问题