
《C程序设计语言》学习
文章平均质量分 77
Crongbx
The higher I got, the more amazing I was by the view.
展开
-
【书中示例】--《C程序设计语言》第二章:类型、运算符、表达式
/* string(),返回字符串s的长度 */ int string(char s[]) { int i; for (i = 0;s[i] != '\0';i++) ; return i; } /* 判断是否为闰年 */ if ((0 == year % 4 && 0 != year % 100) || 0 == year % 400) printf("%d is a原创 2017-09-18 17:54:02 · 495 阅读 · 0 评论 -
【书中示例】-《C程序设计语言》第三章:控制流
/* binsearch(),二分查找,在v[0]<=v[1]...<=v[n-1]中查找x */ int binsearch(int x, int v[], int n) { int low, high, mid;//! low = 0; high = n - 1; while (low <= high) { mid = (low + high) / 2; if (v[m原创 2017-09-21 20:11:51 · 525 阅读 · 0 评论