c语言程序控制台出现乱码
#include<stdio.h>#include<stdlib.h>#defineN10structlist#include<stdio.h>#include<stdl...
#include<stdio.h>
#include<stdlib.h>
#define N 10
struct list
#include<stdio.h>
#include<stdlib.h>
#define N 10
struct list
{
int data;
struct list *next;
};
int main()
{
int i;
struct list *head;
head=(struct list*)malloc( sizeof(struct list) );
struct list *p, *q;
head->next=NULL;
p=head;
int a[N]={2,0,1,7,1,1,6,2,3,7};
for(i=0; i<N; i++)
{
q=(struct list*)malloc( sizeof(struct list) );
q->data=a[i];
q->next = p->next;
p->next=q;
}
while(p!=NULL)
{
printf("%d ", p->data);
p=p->next;
}
}
#include<stdio.h>
#include<stdlib.h>
#define N 10
struct list
{
int data;
struct list *next;
};
int main()
{
int i;
struct list *head;
head=(struct list*)malloc( sizeof(struct list) );
struct list *p, *q;
head->next=NULL;
p=head;
int a[N]={2,0,1,7,1,1,6,2,3,7};
for(i=0; i<N; i++)
{
q=(struct list*)malloc( sizeof(struct list) );
q->data=a[i];
q->next = p->next;
p->next=q;
}
while(p!=NULL)
{
printf("%d ", p->data);
p=p->next;
}
} 展开
#include<stdlib.h>
#define N 10
struct list
#include<stdio.h>
#include<stdlib.h>
#define N 10
struct list
{
int data;
struct list *next;
};
int main()
{
int i;
struct list *head;
head=(struct list*)malloc( sizeof(struct list) );
struct list *p, *q;
head->next=NULL;
p=head;
int a[N]={2,0,1,7,1,1,6,2,3,7};
for(i=0; i<N; i++)
{
q=(struct list*)malloc( sizeof(struct list) );
q->data=a[i];
q->next = p->next;
p->next=q;
}
while(p!=NULL)
{
printf("%d ", p->data);
p=p->next;
}
}
#include<stdio.h>
#include<stdlib.h>
#define N 10
struct list
{
int data;
struct list *next;
};
int main()
{
int i;
struct list *head;
head=(struct list*)malloc( sizeof(struct list) );
struct list *p, *q;
head->next=NULL;
p=head;
int a[N]={2,0,1,7,1,1,6,2,3,7};
for(i=0; i<N; i++)
{
q=(struct list*)malloc( sizeof(struct list) );
q->data=a[i];
q->next = p->next;
p->next=q;
}
while(p!=NULL)
{
printf("%d ", p->data);
p=p->next;
}
} 展开
展开全部
#include <stdio.h>
#include <stdlib.h>
#define N 10
struct list
{
int data;
struct list* next;
};
int main()
{
int i;
struct list* head;
head = (struct list*)malloc(sizeof(struct list));
struct list *p, *q;
head->next = NULL;
p = head;
int a[N] = { 2, 0, 1, 7, 1, 1, 6, 2, 3, 7 };
for (i = 0; i < N; i++)
{
q = (struct list*)malloc(sizeof(struct list));
q->data = a[i];
q->next = NULL;//<============
p->next = q;
p = q;//<============
}
p=head->next;//<============
while (p != NULL)
{
printf("%d ", p->data);
p = p->next;
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询