【发布时间】:2019-05-03 01:11:38
【问题描述】:
我想将一些数组结构传递给一个函数,以便我可以按年龄重新排序。不知道怎么打。
typedef structure {
char name[100];
int age;
}person;
person function ( How do I pass them? )
{
reordering;
}
int main(){
printf("How many ppl?");
...
person *v[n]; ( I decided to not use dynamic allocation for simplicity of example
for(i=0;i<n;i++)
{
// Names and age reading using arrays
v[i].name
v[i].age
}
function ( ??? );
我想按年龄重新排序。如何将我的数组作为指针传递给将根据人们的年龄重新排序的函数?
【问题讨论】:
标签: c arrays function pointers