Input:
p = 1 > 2 > 3 > 4 > NULL;
q = 1 > 2 > 3 > 4 > NULL;
Output: TRUE
p = 1 > 2 > 3 > 4 > NULL;
q = 1 > 2 > 3 > 4 > NULL;
Output: TRUE
#define TRUE 1
#define FALSE 0
int check(NODE *p, NODE *q) {
if( p == NULL && q == NULL)
return TRUE;
while( p != NULL ) {
if( q == NULL )
return FALSE;
if( p->info != q->info )
return FALSE;
p = p->next;
q = q->next;
}
}
No comments :
Post a Comment