69,374
社区成员
发帖
与我相关
我的任务
分享
int *seqlist_find(seqlist *s,Elemtype x)
{
int i=0,j,a[10]={0};
for(j=0;j<s->numinlist;j++)
{
if(x==s->listarray[j])a[i++]=j+1;
}
return a;
}
int *seqlist_find(seqlist *s,Elemtype x)
{
int i=0,j,a[10]={0};
for(j=0;j<s->numinlist;j++)
{
if(x==s->listarray[j])a[i++]=j+1;
}
return a;
}
你返回了局部数组了
改
int *seqlist_find(seqlist *s,Elemtype x)
{
int i=0,j;
static a[10];
memset(a, 0, sizeof(a));
for(j=0;j<s->numinlist;j++)
{
if(x==s->listarray[j])a[i++]=j+1;
}
return a;
}
#include "stdio.h"
int a(int x,int y)
{ int z;
z=x+y;
return z;
}
main()
{
int b;
b=a(2,3);
}