为何得到 V的数不对。,?

#include#includeint main(){ struct node { int data[1000]; int last; } *l,*c,t; t= l=c=(struct node )malloc(sizeof(struct node)); t->last= l->last=c->last=-1; int m,n,i; scanf("%d %d",&m,&n); i=m; while(i--) { l->last+=1; scanf("%d",&l->data[l->last]); } i=n; while(i--) { c->last+=1; scanf("%d",&c->data[c->last]); } int v=0,w,p; for(i=0;idata[i]; for(int j=0;jdata[j]==w) {v++; t->last+=1; t->data[t->last]=w; } }} printf("%d",v); / if(v==0) printf("NULL"); for(i=0;idata[i]); if(i!=v-1) printf(" ") ;}/}

你觉得代码这样子贴出来能看么

修改如下,供参考:

#include <stdio.h>
#include <stdlib.h>
int main()
{
    struct node {
        int data[1000];
        int last;
    } *l,*c,*t;
    t = (struct node*)malloc(sizeof(struct node));
    l = (struct node*)malloc(sizeof(struct node));
    c = (struct node*)malloc(sizeof(struct node));
    t->last = l->last = c->last = -1;
    int m,n,i;
    scanf("%d %d",&m,&n);
    i=m;
    while(i--) {
        l->last+=1;
        scanf("%d",&l->data[l->last]);
    }
    i=n;
    while(i--) {
        c->last+=1;
        scanf("%d",&c->data[c->last]);
    }
    int v=0,w,p;
    for(i=0;i<m;i++) {
        w=l->data[i];
        for(int j=0;j<n;j++) {
            if(c->data[j]==w) {
                v++;
                t->last+=1;
                t->data[t->last]=w;
            }
        }
    }
    printf("v=%d\n",v);
    //if(v==0)
    //    printf("NULL");
    for(i=0;i<v;i++) {
        printf("%d",t->data[i]);
        if(i!=v-1) printf(" ") ;
    }
    //}
    return 0;
}