C语言调试结束后会提示需要关闭
来源:百度知道 编辑:UC知道 时间:2024/09/27 23:34:24
#include "stdio.h"
#include "malloc.h"
#include "conio.h"
#define LEN sizeof(struct user)
struct user *head;
void print(struct user *head);
struct user
{
int num;
int shouzhi;
char menlei[10];
char shijian[15];
struct user *next;
};
struct user *creat(void);
void main()
{
head=creat();
print(head);
}
struct user *creat(void)
{
int n,c;
int m;
struct user *p1,*p2;
p1=p2=( struct user *)malloc(LEN);
printf("请输入序号(1,2.......)\n");
scanf("%d",&p1->num);
printf("\n");
printf("请输入收支(收入正号,支出负号)\n");
scanf("%d",&p1->shouzhi);
printf("\n");
printf("请输入门类\n");
scanf("%s",p1->menlei);
printf("\n");
printf("请输入时间(xxxx.xx.xx)&
#include "malloc.h"
#include "conio.h"
#define LEN sizeof(struct user)
struct user *head;
void print(struct user *head);
struct user
{
int num;
int shouzhi;
char menlei[10];
char shijian[15];
struct user *next;
};
struct user *creat(void);
void main()
{
head=creat();
print(head);
}
struct user *creat(void)
{
int n,c;
int m;
struct user *p1,*p2;
p1=p2=( struct user *)malloc(LEN);
printf("请输入序号(1,2.......)\n");
scanf("%d",&p1->num);
printf("\n");
printf("请输入收支(收入正号,支出负号)\n");
scanf("%d",&p1->shouzhi);
printf("\n");
printf("请输入门类\n");
scanf("%s",p1->menlei);
printf("\n");
printf("请输入时间(xxxx.xx.xx)&
在p1=( struct user *)malloc(LEN);
之后别忘了加
p1->next=NULL;
改完的:
#include "stdio.h"
#include "malloc.h"
#include "conio.h"
#define LEN sizeof(struct user)
struct user *head;
void print(struct user *head);
struct user
{
int num;
int shouzhi;
char menlei[10];
char shijian[15];
struct user *next;
};
struct user *creat(void);
void main()
{
head=creat();
print(head);
}
struct user *creat(void)
{
int n,c;
int m;
struct user *p1,*p2;
p1=p2=( struct user *)malloc(LEN);
p1->next=NULL;
printf("请输入序号(1,2.......)\n");
scanf("%d",&p1->num);
printf("\n");
printf("请输入收支(收入正号,支出负号)\n");
scanf("%d",&p1->shouzhi);
printf("\n");