自定义函数内部怎样计算形参数组的长度
typedefstruct{intnumber;intage;}Student;intmain(intargc,constchar*argv[]){@autoreleas...
typedef struct { int number; int age;}Student;int main (int argc, const char * argv[]){ @autoreleasepool { Student stu1 = {345,22}; Student stu2 = {557,24}; Student stu3 = {743,21}; Student arr[] = {stu1,stu2,stu3}; void sortArr(Student _arr[]); // int len = sizeof(arr)/sizeof(int); // printf("len_main = %i\n",len); sortArr(arr); } return 0;}void sortArr(Student _arr[]) { int len = sizeof(_arr)/sizeof(Student); //此处怎样不用多传入参数来求得形参数组的长度?????????? printf("len = %i\n",len);}
展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询