Home > Back-end >  This is what is wrong? Error program received signal sigsegv segmentation fault
This is what is wrong? Error program received signal sigsegv segmentation fault

Time:09-28

Int change1 (slink * head1, slink * head2) {
Slink * p, * q;
Int a [10], j=0, m, n, t;
For (p=head1 - & gt; Next; P!=NULL; P=p - & gt; Next) {
For (q=head2 - & gt; Next; Q!=NULL; Q=q - & gt; Next)
If (p - & gt; data=https://bbs.csdn.net/topics/=q-> data) {
A [j]=p - & gt; data;
J++;
}
}

CodePudding user response:

A [j]=p - & gt; data;//j is that less than 10?

CodePudding user response:

This should be compared two singly linked lists to find out the same elements in the one-dimensional array,
So, list stored in the data type is int, this code can't see,
Whether should add one line: typedef int slink;

CodePudding user response:

refer to the second floor weixin_46695826 response:
this should be compared two singly linked lists, find out the same elements in the one-dimensional array,
So, list stored in the data type is int, this code can't see,
Whether should add one line: typedef int slink;

Yes!
typedef int ElemType;
Typedef struct node {
ElemType data;
Struct node * next;
} slink;

CodePudding user response:

reference weixin_46221273 reply: 3/f
Quote: refer to the second floor weixin_46695826 response:
this should be compared two singly linked lists, find out the same elements in the one-dimensional array,
So, list stored in the data type is int, this code can't see,
Whether should add one line: typedef int slink;

Yes!
typedef int ElemType;
Typedef struct node {
ElemType data;
Struct node * next;
} slink;


# include & lt; Stdio. H>
//if the header file no problem, the compiler might be the problem, I here to run without error prompt

CodePudding user response:

reference 4 floor weixin_46695826 response:
Quote: reference weixin_46221273 reply: 3/f

Quote: refer to the second floor weixin_46695826 response:
this should be compared two singly linked lists, find out the same elements in the one-dimensional array,
So, list stored in the data type is int, this code can't see,
Whether should add one line: typedef int slink;

Yes!
typedef int ElemType;
Typedef struct node {
ElemType data;
Struct node * next;
} slink;


# include & lt; Stdio. H>
//if the header file no problem, the compiler might be the problem, I here to run without error prompt

My tut is. C no. CPP

CodePudding user response:

reference 4 floor weixin_46695826 response:
Quote: reference weixin_46221273 reply: 3/f

Quote: refer to the second floor weixin_46695826 response:
this should be compared two singly linked lists, find out the same elements in the one-dimensional array,
So, list stored in the data type is int, this code can't see,
Whether should add one line: typedef int slink;

Yes!
typedef int ElemType;
Typedef struct node {
ElemType data;
Struct node * next;
} slink;


# include & lt; Stdio. H>
//if the header file no problem, the compiler might be the problem, I here to run without error prompt

Chain table creation? How could not create directly in list?

CodePudding user response:

reference 6 building self-confidence boy reply:
Quote: refer to 4th floor weixin_46695826 response:

Quote: refer to the third floor weixin_46221273 response:

Quote: refer to the second floor weixin_46695826 response:
this should be compared two singly linked lists, find out the same elements in the one-dimensional array,
So, list stored in the data type is int, this code can't see,
Whether should add one line: typedef int slink;

Yes!
typedef int ElemType;
Typedef struct node {
ElemType data;
Struct node * next;
} slink;


# include & lt; Stdio. H>
//if the header file no problem, the compiler might be the problem, I here to run without error prompt

Chain table creation? How could not create directly in list?

#include typedef int ElemType; Typedef struct node {ElemType data; Struct node * next; } slink; Slink * crelink1 (int n) {head slink * p, * * s; int i; P=head=(slink *) malloc (sizeof (slink)); for(i=1; I<=n; I++) {s=(slink *) malloc (sizeof (slink)); P - & gt; Next=s; The scanf (" % d ", & amp; S - & gt; The data); P=s; } p - & gt; Next=NULL; return head; {} slink * crelink2 (int n) slink * p, * head, * s; Int I, a, [10]. P=head=(slink *) malloc (sizeof (slink)); for(i=0; I
  • Related