摘要: 2013-04-22 1 #include <stdio.h> 2 #include <stdlib.h> 3 4 struct node 5 { 6 int num; 7 struct node *next; 8 }; 9 void creat(struct node **head) 10 { 11 *head = NULL; 12 } 13 void insert_node(struct node **head,struct node **newnode) //建立链表遍历 14 { 15 if(*head == NULL) 16 ... 阅读全文
posted @ 2013-04-22 21:39 菜鸟上路ING 阅读(425) 评论(0) 推荐(0) 编辑
摘要: 原文出处:http://www.cnblogs.com/yc_sunniwell/archive/2010/06/28/1766854.html1. 空指针、NULL指针、零指针1.1什么是空指针常量0、0L、'\0'、3 - 3、0 * 17 (它们都是“integer constant expression”)以及 (void*)0 (我觉得(void*)0应该算是一个空指针吧,更恰当一点)等都是空指针常量(注意 (char*) 0 不叫空指针常量,只是一个空指针值)。至于系统选取哪种形式作为空指针常量使用,则是实现相关的。一般的 C 系统选择 (void*)0 或者 0 阅读全文
posted @ 2013-04-18 12:34 菜鸟上路ING 阅读(758) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h>int head_flag = 0;int success = 0;int my_strlen(char *str) { int i = 0; while(*str != '\0') { i++; str++; } return i;}char *head_add(char *str,char *head){ if(str == NULL ||head == NULL ) { return NULL; } if(my_strlen(str) <... 阅读全文
posted @ 2013-04-16 22:09 菜鸟上路ING 阅读(702) 评论(0) 推荐(0) 编辑
摘要: #includestruct node{ intnum;//4 charname[20]; //20 charsex;//1 intage;//4 floatscore;//4 charadd[30];//30};int main(){ struct nodep;printf("%d",sizeof(p));printf("\n************\n");printf("%d\n",sizeof(float)); return0;}/* 内存地址要对齐。。 结构体每个保存都是按照最长的定义类型来的。 字节对齐的细节和编译器实现相 阅读全文
posted @ 2013-04-16 21:55 菜鸟上路ING 阅读(1044) 评论(1) 推荐(0) 编辑