10;
int i = 0;
Node * list;
list = (Node *)malloc(sizeof(struct Node));
list->data = 0;
list->next = NULL;
for (i = 0; i < num; i++) {
enqueNode(list, i+1);
}
while (list->next != NULL)
{
printf("%d \n", list->data);
list = list->next;
}
system("pause");
return 0;
}
5. typedef 指令
//就是别名
//java 代理
//并没有创建新的数据类型,只是给现有类型创建了别名
typedef int _in;
typedef char * string;
typedef int(*PFI)(char *, char *);
typedef Tnode * Treeptr;
typedef struct Tnode {
char *word;
int count;
/*Tnode * left;
Tnode * right;*/
Treeptr left;
Treeptr right;
} BinaryTreeNode;
int fun(char *, char *) {
return 0;
}
int main() {
_in a = 20;
printf("%d\n", a);
string str;
str = "hello world";
PFI fp;
fp = fun;
char * ch;
ch = "hello world";
BinaryTreeNode* node;
node = (BinaryTreeNode *) malloc(sizeof(BinaryTreeNode));
system("pause");
return 0;
}
6. 公用体 ,枚举
//union
//将不同的数据类型的数据放到同一段内存里面。
//占用的内存大小是 数据类型里面占用最大的那个内存大小
union MyUnion
{
int a;
char b;
float c;
};
int main() {
MyUnion unio;
unio.a = 10;
unio.b = 'a';
unio.c = 1.2f;
printf("a: %#x, b: %#x, c: %#x\n", &unio.a, &unio.b, &unio.c);
// 只能取到 最近赋值的变量
printf("a: %d, b: %c, c: %f\n", unio.a, unio.b, unio.c);
system("pause");
return 0;
}
enum {
monday = 10,
saturday, 、、
sunday,
};