摘要: 1 /* 2 binbit.c -- 使用位操作显示二进制 3 */ 4 5 #include <stdio.h> 6 #include <limits.h> //提供 CHAR_BIT 的定义,CHAR_BIT 表示每字节的位数 7 8 char* itobs(int, char*); 9 voi 阅读全文
posted @ 2018-06-21 10:13 web1013 阅读(127) 评论(0) 推荐(0) 编辑
摘要: 1 /* 2 func_ptr.c -- 使用函数指针 3 */ 4 5 #include <stdio.h> 6 #include <string.h> 7 #include <ctype.h> 8 9 #define LEN 81 10 11 char* s_gets(char *st, int 阅读全文
posted @ 2018-06-15 10:10 web1013 阅读(174) 评论(1) 推荐(1) 编辑
摘要: 1 /* 2 enum.c -- 使用枚举类型的值 3 */ 4 5 #include <stdio.h> 6 #include <string.h> 7 //#include <stdbool.h> //C99特性 8 9 #define LEN 30 10 11 char* s_gets(cha 阅读全文
posted @ 2018-06-14 22:19 web1013 阅读(126) 评论(0) 推荐(0) 编辑
摘要: 1 /* 2 booksave.c -- 在文件中保存结构中的内容 3 */ 4 5 #include <stdio.h> 6 #include <stdlib.h> 7 #include <string.h> 8 9 #define MAXTITL 40 10 #define MAXAUTL 40 阅读全文
posted @ 2018-06-14 16:31 web1013 阅读(189) 评论(0) 推荐(0) 编辑
摘要: 伸缩型数组成员C99 声明一个伸缩型数组成员的规则: 1.伸缩型数组成员必须是结构的最后一个成员; 2.结构中必须至少有一个成员; 3.伸缩数组的方括号是空的。 示例 struct flex { int count; double average; double scores[]; //伸缩型数组成 阅读全文
posted @ 2018-06-14 09:47 web1013 阅读(306) 评论(0) 推荐(0) 编辑
摘要: 1 /* 2 names3.c -- 使用指针和 malloc() 3 */ 4 5 #include <stdio.h> 6 #include <string.h> //提供 strcpy()、strlen() 原型 7 #include <stdlib.h> //提供 malloc()、free 阅读全文
posted @ 2018-06-13 16:29 web1013 阅读(189) 评论(0) 推荐(0) 编辑
摘要: 1 * 2 names1.c -- 使用指向结构的指针 3 */ 4 5 #include <stdio.h> 6 #include <string.h> 7 8 #define NLEN 30 9 10 struct namect 11 { 12 char fname[NLEN]; 13 char 阅读全文
posted @ 2018-06-13 14:33 web1013 阅读(140) 评论(0) 推荐(0) 编辑
摘要: 1 /* 2 append.c -- 把文件附加到另一个文件末尾 3 */ 4 5 #include <stdio.h> 6 #include <stdlib.h> 7 #include <string.h> 8 9 #define BUFSIZE 4096 10 #define SLEN 81 1 阅读全文
posted @ 2018-06-12 10:22 web1013 阅读(332) 评论(0) 推荐(0) 编辑
摘要: 1 /* 2 count.c -- 使用标准 I/O 3 */ 4 5 #include <stdio.h> 6 #include <stdlib.h> //提供 exit() 函数原型 7 8 int main(int argc, char *argv[]) 9 { 10 int ch; //读取 阅读全文
posted @ 2018-06-07 10:30 web1013 阅读(195) 评论(0) 推荐(0) 编辑
摘要: 1 /* 2 parta.c -- 不同的存储类别 3 */ 4 5 #include <stdio.h> 6 7 void report_count(); 8 void accumulate(int k); 9 10 int count = 0; //文件作用于,外部链接 11 12 int ma 阅读全文
posted @ 2018-06-05 13:59 web1013 阅读(202) 评论(0) 推荐(0) 编辑