1960 ALGOL 60 1963 CPLCombined Programming Language 1967
1960 ALGOL 60 1963 英国剑桥大学 CPL(Combined Programming Language) 1967 英国剑桥大学 Matin Richards BCPL(Basic Combined Programming Languege) 1970 美国BELL 实验室的Ken Thompson 简化了 BCPL 提出B语言,并用B写了第一个UNIX操作系统。
32个关键字:(由系统定义,不能重作其它定义) auto break case char const continue default do double else enum extern float for goto if int long register Return short signed sizeof statec structt switch typedef unsigned union volatile while viod
9种控制语句: if( )~else~ for( )~ while( )~ do~while( ) Continue Break Switch Goto Return
C程序设计 第一章 C语言概述 1. 3 简单的C程序介绍 例1. 1 显示字符串 Hello, World! /* example 1. 1 The first C Program*/ #include <stdio. h> main() { printf(“Hello, World!”); } 输出: Hello, World! 运行程序
C程序设计 第一章 C语言概述 例1. 2 /* example 1. 1 calculate the sum of a and b*/ #include <stdio. h> /* This is the main program */ main() { int a, b, sum; a=10; b=24; sum=add(a, b); printf(”sum= %dn", sum); } /* This function calculates the sum of x and y */ int add(int x, int y) 输出: { int z; 运行程序 sum=34 z=x+y; return(z); }
- Slides: 20