B語言

维基百科,自由的百科全书
跳转至: 导航搜索
B语言
发行时间
1969
設計者
肯·汤普森
實作者
肯·汤普森, 丹尼斯·利奇
啟發語言
BCPL, PL/I
影響語言
C语言

B 語言是一种通用的程序设计语言。自從被C 語言取代之後,它幾乎已遭棄置。B 語言大約是於1969年時由美國貝爾實驗室電腦科學家──肯·湯普森丹尼斯·利奇的支持下設計出來的。後來,丹尼斯·利奇以 B 語言為基礎開發出 C 語言,至此 C 語言漸漸發展成為目前世界上最常用的程式語言之一。

例子 [编辑]

這是肯·湯普森提供的一個源代碼:

/* The following function will print a non-negative number, n, to
  the base b, where 2<=b<=10,  This routine uses the fact that
  in the ASCII character set, the digits 0 to 9 have sequential
  code values.  */

printn(n,b) {
        extrn putchar;
        auto a;

        if(a=n/b) /* assignment, not test for equality */
                printn(a, b); /* recursive */
        putchar(n%b + '0');
}

參見 [编辑]

外部鏈接 [编辑]