The C Programming Language 第1章

The C programming Language推荐 The C Programming Language译作《C程序设计语言》,是由著名的计算机科学家Brian W. Kernighan和C语言之父的Dennis M. Ritchie合著的一部计算机科学著作,是第一部介绍C语言编程方法的书籍。它是一本必读的程序设计语言方面的参考书。它在C语言的发展和普及过程中起到了非常重要的作用,被视为是C语言的业界标准规范,而且至今仍然广泛使用。它也被公认为计算机 阅读详情

1.1 概述
1、注意各种转义字符。

      以前从来没有注意过转义字符。有个很奇怪的问题是这样的。怎么手动输入一个'\0'字符。答案是Ctrl + @就可以输入一个'\0'结束符。

     比如一个简单的测试程序:

    

#include <stdio.h>

int main(void) {
    char str[100];
    while (scanf("%s", str) != EOF) {
        printf("%s\n", str);
    }
    return 0;
}

$ cc test.c -o test
$ ./test
abc
abc
abc^@
abc
abc^@def
abc
^abcdefg


这里再给出ASCII字符表。



练习1-1

在你自己的系统中运行"Hello, world"程序。再有意去掉程序中的部分内容,看看会得到什么出错信息。

答:

比如删除printf最后的分号。

#include <stdio.h>
int main(void) {
    printf("Hello world\n")
    return 0;
}

会得到出错信息如下:

# cc c.c -o c
c.c: In function ‘main’:
c.c:4:5: error: expected ‘;’ before ‘return’

练习1-2

做个实验,当printf函数的参数字符串中包含\c(其中c上面的转义字符序列中未曾列出的某一个字符)时,观察一下会出现什么情况。

答:

#include <stdio.h>
int main(void) {
    printf("Hello world\c");
    return 0;
}
编译会有警告,但是可以通过编译。

警告信息如下:

# cc c.c -o c
c.c: In function ‘main’:
c.c:3:12: warning: unknown escape sequence: '\c' [enabled by default]

运行结果如下:

# ./c
Hello worldc#

1.2 变量与算术表达式

首先是写一个程序,用来进行华氏温度与摄氏温度的转换。

转换公式如下:

C = 5/9  * (F - 32)

其中C表示摄氏温度,而F表示华氏温度。

我写的程序如下:

#include <stdio.h>

int main(void) {
    const int fbegin = 0, fend = 300, step = 20;
    int i = fbegin - step;

    while ((i+=step) <= fend) {
        printf("%3d\t%.1f\n", i, 5.0*(i-32.0)/9.0);
    }

    return 0;
}

Note printf输出格式

值得注意的是在这里简单地提到了printf的输出格式,

%d          表示输出整数

%6d        按6个字符的宽度进行输出。右对齐,前面不足的补空字符。

%f            按照浮点数进行打印。

%6f          按照小数点之前最少6个字符宽度进行输出。不足的补空字符。

%6.2f      小数点前面最少6个字符,不足补空字符。小数点后面最多2个字符,不足补0.

%o          按8进制进行输出。

%x           按16进制进行输出。

%c           表示输出字符。

%s           表示输出字符串

%%         输出百分号

%lu         输出long unsigned int

%u          输出unsigned int

%llu        输出long long unsigned int


练习1-3

修改温度转换程序,使之可以在顶部输出一个标题。

答:直接在输出表之前,打印出一个标题就可以了。注意格式控制。

#include <stdio.h>

int main(void) {
    const int fbegin = 0, fend = 300, step = 20;
    int i = fbegin - step;

    printf("%3s\t%s\n", "F", "C");
    while ((i+=step) <= fend) {
        printf("%3d\t%.1f\n", i, 5.0*(i-32.0)/9.0);
    }

    return 0;
}
注意%3s的使用。从而可以实现对齐输出。

# ./a
  F     C
  0     -17.8
 20     -6.7
 40     4.4
 60     15.6
 80     26.7
100     37.8
120     48.9
140     60.0
160     71.1
180     82.2
200     93.3
220     104.4
240     115.6
260     126.7
280     137.8
300     148.9

练习1-4

编写一个程序打印摄氏温度转换为相应华氏温度的转换表。

#include <stdio.h>

int main(void) {
    const int cbegin = 0, cend = 100, step = 10;
    int i = cbegin - step;
    double f = 0;

    printf("%3s\t%s\n", "C", "F");
    while ((i+=step) <= cend) {
        printf("%3d\t%.1f\n", i, 9.0*i/5.0 + 32.0);
    }
    return 0;
}

1.3 for 语句

for 语句应该还算比较简单的。

练习1-5

修改温度转换程序,要求以逆序打印温度转换表。

#include <stdio.h>

int main(void) {
    const int fbegin = 0, fend = 300, step = 20;
    int i = fend + 20;
    double c = 0;

    printf("%3s\t%s\n", "F", "C");
    while ((i-=step) >= fbegin) {
        printf("%3d\t%.1f\n", i, 5.0/9.0*(i-32.0));
    }
    return 0;
}

1.4. 符号常量

符号常量是我们需要注意的地方。也就是说,在程序里面,除了0,1这种经常使用的变量以外。其他的比如100,200,这种变量应该最好是使用

#define MAXSIZE 100

的方式给出。


1.5.1 文件复制

这里提供一个文件复制程序。唯一值得注意的是。变量ch的类型为int,而不是char类型。因为getchar()的返回值就是int类型。

#include <stdio.h>

int main(void) {
    int ch;
    while ((ch=getchar()) != EOF) {
        putchar(ch);
    }
    return 0;
}

练习1-6

验证表达式getchar() != EOF的值是0还是1.

答:

改写程序如下:

#include <stdio.h>

int main(void) {
    int ch;
    while (ch = getchar()!=EOF) {
        printf("%d\n", ch);
    }
    return 0;
}

练习1-7

编写一个打印EOF值的程序

答:

#include <stdio.h>

int main(void) {
    printf("%d\n", EOF);
    return 0;
}

1.5.2 字符计数

首先是计算输入字符的个数。

#include <stdio.h>

int main(void) {
    int cnt = 0;
    while (getchar() != EOF)
        ++cnt;
    printf("%d\n", cnt);
    return 0;
}

计算输入了多少行。

#include <stdio.h>

int main(void) {
    int cnt = 0, ch;
    while ((ch=getchar()) != EOF)
        cnt += ch == '\n';
    printf("%d\n", cnt);
    return 0;
}

练习1-8

编写一个统计空格、制表符与换行符个数的程序。

#include <stdio.h>

int main(void) {
    int space_cnt = 0, tab_cnt = 0, enter_cnt = 0, ch;
    while ((ch=getchar()) != EOF) {
        space_cnt += ch == ' ' ;
        tab_cnt += ch == '\t';
        enter_cnt += ch == '\n';
    }
    printf("%4s %4s %4s\n", "S", "T", "E");
    printf("%4d %4d %4d\n", space_cnt, tab_cnt, enter_cnt);
    return 0;
}

练习1-9

编写一个程序,把输入中的连续空格用一个空格替代。

#include <stdio.h>

int main(void) {
    int front_ch = 0, ch;
    while ((ch=getchar()) != EOF) {
        if (' ' != ch || (' ' == ch && ' ' != front_ch)) {
            putchar(ch);
            front_ch = ch;
        }
    }
    return 0;
}

其实很简单,只需要注意把前面一个字符的状态记住就可以。

练习1-10

编写一个程序,把输入中的'\t', '\b', '\' 替换为\t, \t, \\。

#include <stdio.h>

int main(void) {
    int ch;
    while ((ch=getchar()) != EOF) {
        if ('\t' == ch) printf("\\t");
        else if ('\b' == ch) printf("\\b");
        else if ('\\' == ch) printf("\\\\");
        else putchar(ch);
    }
    return 0;
}

1.5.3单词计数

方法其实也比较简单,就是统计一下空白符与非空白符交接处的个数。

如果用_表示空白符。那么_______________abbbbbb_________c

很明显,只有两个交接处。所以只有两个单词。

#include <stdio.h>

int main(void) {
    int ch, nw = 0, front_is_space = 1;
    while ((ch=getchar()) != EOF) {
        if ('\t' == ch || ' ' == ch || '\n' == ch)
            front_is_space = 1;
        else if (front_is_space) {
            front_is_space = 0;
            ++nw;
        }
    }
    printf("%d\n", nw);
    return 0;
}

练习1-11

你准备如何测试单词计数程序?如果程序中存在某种错误,那么什么样的输入最可能发现这种错误?

答:

没有输入

没有单词,只有换行符。

没有单词,比如只有空白符。

每个单词占一行。

单词出现于文本行行首的情况

单词都是出现在很多空白符后的情况。

练习1-12

编写一个程序,以每行一个单词的形式打印其输入。

有了前面统计单词个数的程序。这个程序只需要匹配到_____abc这种空白符与非空白符交接处的时候,打印一个回车应该就可以了。

#include <stdio.h>

int main(void) {
    int ch, front_is_space = 0;
    while ((ch=getchar()) != EOF) {
        if (' ' == ch || '\t' == ch || '\n' == ch) {
            front_is_space = 1;
        } else if (front_is_space) {
            front_is_space = 0;
            putchar('\n');
            putchar(ch);
        } else putchar(ch);
    }
    return 0;
}

1.6 数组


写一个程序对数字,空格,其他字符进行计数。

#include <stdio.h>
#include <string.h>

int main(void) {
    int cnt[10], nw = 0, ns = 0, ch, i;
    memset(cnt, 0, sizeof(cnt));

    while ((ch=getchar()) != EOF) {
        if ('0' <= ch && ch <= '9') ++cnt[ch-'0'];
        if (' ' == ch || '\n' == ch || '\t' == ch) ++ns;
        else ++ns;
    }

    for (i = 0; i < 10; ++i) {
        printf("%d ", i);
    }
    printf("\n");
    for (i = 0; i < 10; ++i) {
        printf("%d ", cnt[i]);
    }
    printf("\n");

    printf("Spaces: %d\n", ns);
    printf("Others: %d\n", nw);
    return 0;
}


练习1-13

编写一个程序,统计输入的单词的长度。水平方向的直方图比较好打印。打印一个垂直方向的直方图。

答:

首先我们要写一个程序,当我们输入一个单词的时候,他就可以返回这个单词的长度。

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(void) {
    int front_is_space = 1, ch, len = 0;
    while ((ch=getchar()) != EOF) {
        if (' ' == ch || '\t' == ch || '\n' == ch) {
            if (!front_is_space) {
                printf("%d\n", len);
                len = 0;
            }
            front_is_space = 1;
        } else {
            ++len;
            front_is_space = 0;
        }
    }
    return 0;
}


在此基础上,则很容易对单词进行计数处理了。

在这里,我们假设每个单词的长度都不超过255。这个设定当然是有一定的局限性的。当统计完成单词的长度之后,我们开始打印水平方面的直方图。

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define MAX_LEN 255

int main(void) {
    int front_is_space = 1, ch, len = 0;
    int cnt[MAX_LEN], i;

    memset(cnt, 0, sizeof(cnt));

    while ((ch=getchar()) != EOF) {
        if (' ' == ch || '\t' == ch || '\n' == ch) {
            if (!front_is_space) {
                ++cnt[len];
                len = 0;
            }
            front_is_space = 1;
        } else {
            ++len;
            front_is_space = 0;
        }
    }

    for (i = 0; i < MAX_LEN; ++i) {
        if (cnt[i]) {
            printf("%3d : ", i);
            for (ch = 0; ch < cnt[i]; ++ch)
                printf("-");
            printf("\n");
        }
    }
    return 0;
}


水平方向打印直方图是比较简单的。那么看一下垂直方向的直方图。

打印垂直方向的直方图。

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define MAX_LEN 255

int main(void) {
    int front_is_space = 1, ch, len = 0;
    int cnt[MAX_LEN], i, max_value = 0;
    int idx[MAX_LEN], iter;

    memset(cnt, 0, sizeof(cnt));

    while ((ch=getchar()) != EOF) {
        if (' ' == ch || '\t' == ch || '\n' == ch) {
            if (!front_is_space) { 
                ++cnt[len];
                len = 0;
            }
            front_is_space = 1;
        } else {
            ++len;
            front_is_space = 0;
        }
    }

    for (max_value = i = iter = 0; i < MAX_LEN; ++i) {
        if (cnt[i]) {
            max_value = max_value > cnt[i] ? max_value : cnt[i];
            cnt[iter] = cnt[i];
            idx[iter] = i;
            ++iter;
        }
    }

    for (i = 0; i < iter; ++i) {
        if (cnt[i] == max_value) {
            printf("%5d", max_value);
        } else printf("     ");
        printf(" ");
    }
    printf("\n");

    while (max_value > 0) {
        for (i = 0; i < iter; ++i) {
            if (cnt[i] == (max_value-1)) printf("%5d", cnt[i]);
            else if (cnt[i] >= max_value) printf("|---|");
            else printf("     ");
            printf(" ");
        }
        printf("\n");
        --max_value;
    }

    for (i = 0; i < iter+1; ++i) printf("******");
    printf("\n");
    for (i = 0; i < iter; ++i) {
        printf("%5d ", idx[i]);
    }
    printf("\n");
    return 0;
}


打印出来的效果图。

|---| |---|    18
|---| |---| |---|
|---| |---| |---|
|---| |---| |---|
|---| |---| |---|
|---| |---| |---|    13
|---| |---| |---| |---|
|---| |---| |---| |---|       
|---| |---| |---| |---|       
|---| |---| |---| |---|       
|---| |---| |---| |---|       
|---| |---| |---| |---|       
|---| |---| |---| |---|     6 
|---| |---| |---| |---| |---| 
|---| |---| |---| |---| |---| 
|---| |---| |---| |---| |---| 
|---| |---| |---| |---| |---| 
|---| |---| |---| |---| |---| 
|---| |---| |---| |---| |---| 
******************************
    1     2     3     4     5 

 

练习1-14

编写一个程序,用来统计字符出现的频率。用垂直方向的直方图来进行表示。

首先来个效果:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define MAX_LEN 255

void print_histogram(int *cnt, int n) {
    int max_value, i, iter, idx[MAX_LEN];

    for (max_value = i = iter = 0; i < n; ++i) {
        if (cnt[i]) {
            max_value = max_value > cnt[i] ? max_value : cnt[i];
            cnt[iter] = cnt[i];
            idx[iter] = i;
            ++iter;
        }
    }

    for (i = 0; i < iter; ++i) {
        if (cnt[i] == max_value) {
            printf("%5d", max_value);
        } else printf("     ");
        printf(" ");
    }
    printf("\n");

    while (max_value > 0) {
        for (i = 0; i < iter; ++i) {
            if (cnt[i] == (max_value-1)) printf("%5d", cnt[i]);
            else if (cnt[i] >= max_value) printf("|---|");
            else printf("     ");
            printf(" ");
        }
        printf("\n");
        --max_value;
    }

    for (i = 0; i < iter+1; ++i) printf("******");
    printf("\n");
    for (i = 0; i < iter; ++i) {
        printf("%5d ", idx[i]);
    }
    printf("\n");
 
}

int main(void) {
    int front_is_space = 1, ch, len = 0;
    int cnt[MAX_LEN], i;

    memset(cnt, 0, sizeof(cnt));

    while ((ch=getchar()) != EOF) {
        ++cnt[ch];
    }

    print_histogram(cnt, MAX_LEN);
    return 0;
}


当直方图下面元素太多时,会出现问题,不过也还好了。你把输出重定向到一个文件,然后vim打开。再 set nowrap。

就可以看到想要的效果。

如果想要改进,就再改写一下程序。也不算太难。

1.7 函数

在这里,需要注意的是函数的声明方式:

int power(int x, int n);

不再采用传统的声明方式。

练习1-15
用函数的方式,来写华氏温度向摄氏温度的转换。

#include <stdio.h>

const double h2c(const double d) {
    return 5.0*(d-32.0)/9.0;
}

int main(void) {
    double temp = 0.0;
    while (temp < 300.0) {
        printf("%3.0f %3.1f\n", temp, h2c(temp));
        temp += 20;
    }
    return 0;
}


1.8 参数-传值调用

在这里,需要说明的是,对于C语言而言,所有的参数都是采用传值调用的。

比如

void can_not_change(int a) {
    a = 2;
}
int b = 1;
can_not_change(b); // b still equal to 1


void can_change(int *a) {
    *a = 3; // change *a;
    a = 0;
}
int *a = &b;
can_change(a); // b's value is changed.
               // but pointer a still unchanged.


但是需要注意的是传入数组参数的处理。当传入一维数组的时候,可以用int *a做为参数。当传入两维数组的时候,则不能用int **a做为参数。

1.9 字符数组

书上写了一个程序,是输入一个长度不超过1024的字符串的时候。找出最长的字符串来。

我没有照着书上的写,自己写了一个版本。用不着进行copy操作。

#include <stdio.h>
#define MAXLEN 1024

int _getline(char *str, int n) {
    int i = 0, ch;
    while (i < (n-2) && (ch=getchar()) != EOF && '\n' != ch)
        str[i++] = ch;

    if ('\n' == ch) str[i++] = ch;
    str[i] = 0;
    return i;
}

int main(void) {
    int len, max_len = -1;
    char a[MAXLEN], b[MAXLEN];
    char *input = a, *str = b, *t;

    while ((len = _getline(input, MAXLEN)) > 0) {
        if (len > max_len) {
            max_len = len;
            t = str; str = input; input = t;
        }
    }
    printf("maxlen = %d, %s\n", max_len, str);
    return 0;
}


练习1-16

题目:修改打印最长文本行的程序的主程序main,使之可以打印任何输入行的长度,并且尽可能多地打印文本。

#include <stdio.h>
#include <stdlib.h>
#define MAXLEN 10

int _getline(char **str, int *max_len) {
    int i = 0, ch;
    while ((ch=getchar()) != EOF && '\n' != ch) {
        if ((*max_len - 2) == i) {
            (*max_len) <<= 1;
            *str = (char *)realloc(*str, *max_len);
        }
        (*str)[i++] = ch;
    }
    (*str)[i] = 0;
    return i;
}

int main(void) {
    int len, max_len = -1;
    int ib = MAXLEN, sb = MAXLEN, temp;
    char *input = (char *)malloc(sizeof(char)*MAXLEN);
    char *str = (char *)malloc(sizeof(char)*MAXLEN);
    char *t;

    while ((len = _getline(&input, &ib)) > 0) {
        if (len > max_len) {
            max_len = len;
            t = str; str = input; input = t;
            temp = ib; ib = sb; sb = temp;
        }
    }
    printf("maxlen = %d, %s\n", max_len, str);
	free(input);
	free(str);
    return 0;
}

这里需要用realloc函数。尽管有点超前了。不过需要注意的是,在swap的时候,除了交换指针之外,还要注意交换buffer_size.也就是ib和sb的值。

 练习1-17

题目:编写一个程序,打印长度超过80个字符的所有输入。

#include <stdio.h>
#include <stdlib.h>
#define MAXLEN 10

int _getline(char **str, int *max_len) {
    int i = 0, ch;
    while ((ch=getchar()) != EOF && '\n' != ch) {
        if ((*max_len - 2) == i) {
            (*max_len) <<= 1;
            *str = (char *)realloc(*str, *max_len);
        }
        (*str)[i++] = ch;
    }
    (*str)[i] = 0;
    return i;
}

int main(void) {
    int len;
    int ib = MAXLEN;
    char *input = (char *)malloc(sizeof(char)*MAXLEN);

    while ((len = _getline(&input, &ib)) > 0) {
		if (len > 80) {
			printf("%s\n", input);
		}
    }
	free(input);
    return 0;
}

练习1-18

题目:编写一个程序,删除每个输入行未尾的空白符与制表符。并且删除完全是空白符的行。

#include <stdio.h>
#include <stdlib.h>
#define MAXLEN 10

int _delete_space_from_back(char *str, int n) {
	int i = n;
	while ((--i) >= 0 && (' ' == str[i] || '\t' == str[i]));
	str[i+1] = 0;
	return i + 1;
}

int _getline(char **str, int *max_len) {
    int i = 0, ch;
    while ((ch=getchar()) != EOF && '\n' != ch) {
        if ((*max_len - 2) == i) {
            (*max_len) <<= 1;
            *str = (char *)realloc(*str, *max_len);
        }
        (*str)[i++] = ch;
    }
    (*str)[i] = 0;
	i = _delete_space_from_back(*str, i);
	if (0 == i && EOF == ch) return EOF;
    return i;
}

int main(void) {
    int len;
    int ib = MAXLEN;
    char *input = (char *)malloc(sizeof(char)*MAXLEN);

    while ((len = _getline(&input, &ib)) != EOF) {
		if (len > 0) printf("%s\n", input);
    }
	free(input);
    return 0;
}

练习1-19

题目:编写一下字符串颠倒函数reverse()。

#include <stdio.h>
#include <stdlib.h>
#define MAXLEN 10

void reverse(char *str, int n) {
	char *i = str, *j = str + n - 1, t;
	while (i < j) {
		t = *i; *i = *j; *j = t;
		++i; --j;
	}
}

int _getline(char **str, int *max_len) {
    int i = 0, ch;
    while ((ch=getchar()) != EOF && '\n' != ch) {
        if ((*max_len - 2) == i) {
            (*max_len) <<= 1;
            *str = (char *)realloc(*str, *max_len);
        }
        (*str)[i++] = ch;
    }
    (*str)[i] = 0;
	reverse(*str, i);
	if (0 == i && EOF == ch) return EOF;
    return i;
}

int main(void) {
    int len;
    int ib = MAXLEN;
    char *input = (char *)malloc(sizeof(char)*MAXLEN);

    while ((len = _getline(&input, &ib)) != EOF) {
		if (len > 0) printf("%s\n", input);
    }
	free(input);
    return 0;
}

注意在反转的时候,不要把i < j写成i != j。在偶数个字符的情况下,容易出错。




《The C programming language》学习笔记 Brian和Dennis的《c程序设计语言》(The C Programming Language)真不愧为c语言方面的经典书籍,薄薄的一本,却让人爱不释手,每次阅读都能有所收获。好记忆不如烂笔头,有些规则、算法还是记录下来比较好,记录下来常常回顾,才是提升编程内功的不二法门。下面言归正传…… 阅读详情

相关推荐

【第一部分 第一章】The C Programming Language 程序研究 【持续更新】

The C Programming Language程序研究   前言 C语言之父创作的The C Programming Language一书对于所有学习C语言的人来说都可以算作一部圣经。它不到200页的篇幅却几近完整地阐述了C语言的各个方面,不仅如此,书中的每个例程和练习都展现了作者丰富的C编程经验,对于初学者来说这些例程和练习并不是那么简单,即使是对于有些经验的C语言工作者来说,也有很

DuanXu-yzc 2167

《The C Programming Language》读书笔记总结 <一>.基础篇

写了这么多年的C代码,回过头来再看《The C Programming Language》这本书,作者Brian W. Kernighan和C语言之父Dennis M. Ritchie。感觉里面的知识和书的架构给人非常”合理”的感觉。怎么个合理法呢? 首先书中的代码,如else-if中使用binsearch函数介绍二分查找、atoi...

weixin_33690963的博客 459

The C Programming Language第二版中文版.pdf

The C Programming Language第二版中文版

【社区图书馆】伴我前行的一本书《The C Programming Language》

C语言本身的魅力就毋庸置疑。C语言几乎可以胜任任何领域的工作,其广泛程度令其它语言望尘莫及。虽然java号称宇宙编程语言,但是,java的底层虚拟机的实现,几乎就是C/C++来编写的。

记录和分享程序人生的点点滴滴 1253

麒麟V10桌面操作系统安装Qt5.12.3

在虚拟机中如何安装麒麟V10桌面系统,以及在麒麟系统中安装Qt框架,并正常编译运行Qt程序

阿龙的思考 3599

sentaurus学习笔记(HFET_pGate_GaN仿真)(九)

`(sdedr:define-constant-profile-placement "Ohmic.s" "Ohmic" "Pl.ohmic.s" 0.002)`这一行将`"Ohmic"`掺杂剖面放置在`"Pl.ohmic.s"`参考评估窗口中,同样`0.002`可能表示掺杂剖面在窗口中的偏移量或其他参数。欧姆接触是半导体器件中的一种低阻抗电气接触,通常需要高掺杂来减少接触电阻并提高器件性能。通过这些步骤,SDE能够为器件的源极和漏极区域设置高掺杂的欧姆接触,这对于确保器件的高性能和低接触电阻至关重要。

qq_52640792的博客 1382

【免费下载】 The C Programming Language(中文版).pdf

The C Programming Language(中文版).pdf 【下载地址】TheCProgrammingLanguage中文版.pdf分享 The C Programming Language(中文版).pdf 项目地址...

gitblog_06625的博客 6385

ETAP实战:如何用仿真软件快速绘制标准一次接线图(附模板下载)

本文提供了一套基于ETAP软件高效绘制标准一次接线图的完整实战工作流。从国标符号库配置、绘图模板创建,到核心设备绘制、参数标注,再到利用软件模型进行拓扑检查与短路电流校核,手把手教你实现从零到一的专业图纸设计。文末附有实用模板下载,助你大幅提升电力设计效率与图纸质量。

weixin_29291573的博客 511

The C programming language (second edition,K&R) exercise(测试环境)

MinGW,K&R

caoleiwe的博客 1069

图像的低频,中频,高频信息含义?

看很多图像处理的博文,都会说图像的主要成分是低频信息,它形成了图像的基本灰度等级,对图像结构的决定作用较小;中频信息决定了图像的基本结构,形成了图像的主要边缘结构;高频信息形成了图像的边缘和细节,是在中频信息上对图像内容的进一步强化。我有点纳闷,图像不就是一堆像素点构成的三维矩阵吗?跟频率有啥关系! 针对这个问题,又查了不少网文,解释的也都各不相同。例如, “初学的时候,你可以把高中低这个度量和图像上相邻点的灰度差大小对等起来”。 “感性上来讲,图像越杂乱的部分,频率越高...

jinking01的专栏 3万+

Android音频学习(八)——AudioFlinger线程

在 PlaybackThread 的实现中,Flag 用于标识线程的特殊行为或配置。

miemie2014的博客 1399

[the c programming language]-1章:导言

第一章很杂,介绍c核心功能。

mabo 963

网络攻防——kali操作系统基本使用

主要介绍如何搭建kali虚拟机,然后介绍了一个简单的攻击方法,切记,网络恶意攻击属于违法行为

weixin_46560512的博客 2万+

《The C Programming Language》答案(第一章)

《The C Programming Language》答案(第一章) P1 #include <stdio.h> main() { printf("hello, world\n"); } P2 warning: unknown escape sequence: '\c' P3 #include <stdio.h> main() { float fahr,celsi...

SWY's Workshop 1万+

华为od 面试八股文_操作系统_01_含答案

华为od 面试八股文_操作系统_01_含答案

MISAYAONE的博客 3275

华为的C语言编程规范.pdf

华为技术有限公司内部技术规范。本规范制定了编写C语言程序的基本原则、规则和建议。从代码的清晰、简洁、可测试、安全、程序效率、可移植各个方面对C语言编程作出了具体指导。

《The C Programming Language》答案(第三章)

P1 #include <stdio.h> int binsearch(int x,int v[],int n){ int low = 0; int high = n-1; int mid; while(low<high){ mid = (low+high)/2; if(x<=v[mid]) ...

SWY's Workshop 1万+

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

【亲测免费】 The C Programming Language - 中文版

The C Programming Language - 中文版 【下载地址】TheCProgrammingLanguage-中文版分享 《The C Programming Language》第二版,是一本学习C语言不可或缺的经典教材,由C语言之父丹尼斯·里奇(Dennis Ritchie)和布莱恩· Kernigha...

gitblog_06613的博客 1034

jdk-8u144-linux-x64.tar.gz.

该资源为搭建Linux系统Java环境用,资源的后缀为tar.gz格式的压缩包

IMSL CNL 7.0.0 (x86-64)Crack

IMSL CNL 7.0.0 (x86-64)Crack intel的算法库破解文件,这是C++版本的破解文件

The-C-Programming-Language-2nd-Edition 项目常见问题解决方案

The-C-Programming-Language-2nd-Edition 项目常见问题解决方案 项目基础介绍 The-C-Programming-Language-2nd-Edition 是一个开源项目,旨在提供《The C Programming Language》第二版的源代码和练习解决方案。该项目由 Brian W. Kernighan 和 Dennis M. Ritchie 编写,是学...

gitblog_01188的博客 585

《C程序设计语言》读书笔记01: 《The C Programming Language》全书导学指南

C语言不像Java或Python会帮你检查边界,越界访问数组、使用未初始化的指针,都可能直接导致程序崩溃。

3429

【亲测免费】 探索C语言的精髓:《The C Programming Language》第二版中文版推荐

探索C语言的精髓:《The C Programming Language》第二版中文版推荐 【下载地址】TheCProgrammingLanguage-中文版分享 《The C Programming Language》第二版,是一本学习C语言不可或缺的经典教材,由C语言之父丹尼斯·里奇(Dennis Ritchie)和...

gitblog_06640的博客 483

The C Programming language之1

今天突然间准备重新学习一下C语言,动机是因为最近想学学嵌入式,百度了解一下嵌入式之后发现,C语言对于嵌入式的学习非常重要,所以准备重新系统的学习一下。 为什么要选择The C Programming language? 因为这本书是由C语言的设计者Dennis M. Ritchie和著名计算机科学家Brian W. Kernighan编写,其他的自不必说! Getting Started ...

thebestleo的专栏 773

《The C Programming Language》练习答案项目教程

《The C Programming Language》练习答案项目教程 项目介绍 本项目是针对《The C Programming Language》(第二版)一书中的练习题提供的答案集合。该书由Brian W. Kernighan和Dennis M. Ritchie编写,通常被称为K&R,是学习C语言的经典教材。项目旨在帮助学习者通过参考答案来更好地理解和掌握C语言编程。 项目快速启动...

gitblog_00659的博客 630

《The C Programming Language》 第一章总结

这本书第一章主要是对C语言整体的introduction。分为十个小节: 1.1 Getting Started ; 1.2 Variables and Arithmetic Expressions ; 1.3 The for Statement ; 1.4 Symbolic Constant ; 1.5 Character Input and Output ; 1.6 Arrays ; 1.7

Instein98 429

《THE C PROGRAMMING LANGUAGE》读书笔记一

《THE C PROGRAMMING LANGUAGE》读书笔记一1.1开始经典范例:#include main(){  printf("hello, world/n");}说明:#01 为引用标准输入输出函数库;注意“”为引用标准库时使用,“"..."”则用于引用自定义文件时使用,两者的查找路径不一致,前者搜索标准库目录,而后者则从当前目录查找,然后才考虑

皓月的专栏 622

The C Programming Language 学习(1)——Hello World

这套学习笔记以K&R所著的The C Programming Language (2nd Ed.)为依据,例程使用Dev C++ 5.11在Win7平台上调试。这本教科书薄薄的页,内容丰富,叙述简洁优美,涵盖了ANSI C的各个方面,被亚马逊网站誉为计算机科学领域的圣经,影响了一代又一代的程序员。 作为从事程序设计课程教学多年的教师,推荐这本教材,既适合初学者,也适用于有一定经验的学习者,因此在这里分享学习的笔记和体会。 第一章是C语言快速教程, ...

qiu_shaofeng的博客 456
上一篇: 面试题整理-最小没出现的整数
下一篇: 面试题整理-卡特兰数问题收集
ju136
博客等级 码龄19年 95粉丝 80原创
评论 2
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值