Calculate Length of Array in C by Using Function

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

    Size of an arry in C is :

    int a[]={10,2,22,31,1,2,44,21,5,8};
    
    printf("Size : %d",sizeof(a)/sizeof(int));
    

提交回复
热议问题