历史的选择:C语言

本文探讨了C语言的历史,从BCPL、B语言的演变到C语言的诞生,阐述了C语言在Unix系统发展中起到的关键作用。C语言因其高效、灵活,即使历经多年仍保持其重要地位。通过代码示例展示了三种语言的区别,并强调C语言在现代编程中的不可替代性。
摘要由CSDN通过智能技术生成

目录

BCPL、B、C语言比较

3种语言代码示例

BCPL语言示例

B语言示例

C语言示例

示例代码中三者的区别

历史为什么选择C语言

廉颇老矣, 尚能饭否?

总结

参考资料


BCPL、B、C语言比较

如果想要找到一种好的方式,来进行编程语言之间比较的话,那么非代码莫属。

3种语言代码示例

下面分别使用BCPL、B、C三种语言实现一个简单的程序:程序将三个数字a、b、c相加,并将结果赋值给sum,最后打印总和。

BCPL语言示例

BCPL https://zh.wikipedia.org/wiki/BCPL

GET "libhdr"

LET start() = VALOF
{ LET a, b, c = 1, 2, ,3

    sum := a + b + c
    writen(sum)
}
  • LET 声明变量

  • := 符号为赋值符号 Go中也有该符号,表示函数内部局部变量。这里感觉很有意思的一点是:最初B语言之父肯.汤普逊:=符号改成了=符号。现在,也作为Go语言之父之一,又把:=符号请回来了(冥冥之中的命运~)。

从BCPL到B的过渡中,决定使用单个字符 = 代替赋值 :=

Other fiddles in the transition from BCPL to B were introduced as a matter of taste, and some remain controversial, for example the decision to use the single character = for assignment instead of :=. Similarly, B uses /**/ to enclose comments, where BCPL uses //, to ignore text up to the end of the line. The legacy of PL/I is evident here. (C++ has resurrected the BCPL comment convention.) Fortran influenced the syntax of declarations: B declarations begin with a specifier like auto or static, followed by a list of names, and C not only followed this style but ornamented it by placing its type keywords at the start of declarations.

https://www.bell-labs.com/usr/dmr/www/chist.html

B语言示例

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值