喜我试图创建一个接受7元件阵列作为一个参数,并通过该数组到一个较小的阵列的第五元素返回第三但是我目前收到这个错误传递数组到功能
的程序assign8p7.c: In function 'main':
assign8p7.c:18:2: warning: passing argument 1 of 'copysect' makes pointer from
integer without a cast [enabled by default]
assign8p7.c:3:6: note: expected 'int *' but argument is of type 'int'
从我可以告诉警告有我传递一个数组中的参数没有人知道如何我可能会解决这个问题吗?也欢迎我的代码的任何其他建议。
#include <stdio.h>
int *copysect(int ar[],int start,int end)
{
int i;
static int retar[3];
for(i = 0; i<3;i++)
{
retar[i+start]=ar[i+start];
}
return retar;
}
int main(int argc, char const *argv[])
{
int arry[7] = {1,2,3,4,5,6,7};
int miniarry[3];
miniarry[0] = *copysect(arry[0],3,5);
return 0;
}
编辑您的标题是更多的信息,请.. – Maroun 2013-03-11 14:08:33
@MarounMaroun,你有能力做自己,你知道:) – StoryTeller 2013-03-11 14:09:45
@StoryTeller是的,但我想他知道他应该做的它(未来的):) – Maroun 2013-03-11 14:13:14