当前位置: 技术问答>linux和unix
请教:在linux下如何为一个结构体分配空间?语句该怎么写?
来源: 互联网 发布时间:2015-12-06
本文导语: 我的代码如下,但编译不了: struct listened { char Cookie; long RequestTimeStamp; long RequestFileSize; struct listened *left , *right ; } BufferQueue ; struct BufferQueue *h; int finis...
我的代码如下,但编译不了:
struct listened
{
char Cookie;
long RequestTimeStamp;
long RequestFileSize;
struct listened *left , *right ;
} BufferQueue ;
struct BufferQueue *h;
int finish;
finish = clock( );
char a=(rand()%6+65);
h=( struct BufferQueue *)malloc(sizeof (BufferQueue));
h->Cookie=a ; h->RequestTimeStamp=finish ;
h->RequestFileSize = (rand()%100) ;
恳请哪位高手帮修改一下,多谢!!!!
struct listened
{
char Cookie;
long RequestTimeStamp;
long RequestFileSize;
struct listened *left , *right ;
} BufferQueue ;
struct BufferQueue *h;
int finish;
finish = clock( );
char a=(rand()%6+65);
h=( struct BufferQueue *)malloc(sizeof (BufferQueue));
h->Cookie=a ; h->RequestTimeStamp=finish ;
h->RequestFileSize = (rand()%100) ;
恳请哪位高手帮修改一下,多谢!!!!
|
typedef struct listened
{
char Cookie;
long RequestTimeStamp;
long RequestFileSize;
struct listened *left , *right ;
} BufferQueue ;
BufferQueue *h;
int finish;
finish = clock( );
char a=(rand()%6+65);
h=( BufferQueue *)malloc(sizeof (BufferQueue));
h->Cookie=a ; h->RequestTimeStamp=finish ;
h->RequestFileSize = (rand()%100) ;
{
char Cookie;
long RequestTimeStamp;
long RequestFileSize;
struct listened *left , *right ;
} BufferQueue ;
BufferQueue *h;
int finish;
finish = clock( );
char a=(rand()%6+65);
h=( BufferQueue *)malloc(sizeof (BufferQueue));
h->Cookie=a ; h->RequestTimeStamp=finish ;
h->RequestFileSize = (rand()%100) ;