Calculate Length of Array in C by Using Function

前端 未结 9 656
心在旅途
心在旅途 2020-12-04 18:20

I want to make a FUNCTION which calculates size of passed array.

I will pass an Array as input and it should return its length. I want a Function

int         


        
9条回答
  •  独厮守ぢ
    2020-12-04 19:00

    In C you can't because array decays into a pointer(to the first element) when passed to a function.

    However in C++ you can use Template Argument Deduction to achieve the same.

提交回复
热议问题