Club-IT

c语言里,不能直接在定义结构体时,给其中元素赋值。

#include<stdio.h>
#include<malloc.h>
typedef struct tree
{
    int data;
    struct tree *left;
    struct tree *next=NULL;
}zhizhen;
int main()
{
    struct tree *a;
    a=(zhizhen*)malloc(sizeof(zhizhen));
    if(a->next==NULL)
    printf("asdfasdfa\n");
    else
    printf("no\n");
    return 0;
}

结果为:no

分类:

技术点:

相关文章: