Calculate Length of Array in C by Using Function

前端 未结 9 685
心在旅途
心在旅途 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:04

    What you ask for simply can't be done.

    At run time, the only information made available to the program about an array is the address of its first element. Even the size of the elements is only inferred from the type context in which the array is used.

提交回复
热议问题