70,020
社区成员




struct student *ptsdu
{
char *data;
int name;
}
int construct_student( struct student * ptsdu , iname )
{
ptsdu->data = malloc( DATA_SIZE );
name = iname;
}
在来一个析构函数
int destruct_student( struct student * ptsdu )
{
free( ptsdu );
}
//这么写
#include<string.h>
#include<stdio.h>
#include<memory.h>
#include <malloc.h>
struct student
{
char *data;
int name;
};
void main(void)
{
struct student *ptsdu=(student*)malloc(sizeof(student));
memset(ptsdu,0,sizeof(student));
ptsdu->data="dd";
printf("%s\n",ptsdu->data);
}