-36- default, , . - default , - . case default - , , . break (.0.8). , , - . , . : switch (regim) { case 'x': regx++; case 'X': case 'Y': regY++; break; case '-': regx = 0; break; default: err(""); goto next; } 6.8. break break; while, do, for switch; - , - . 6.9. continue continue; while, do for; . , while(...) { | do { | for(...) { ... | ... | ... contin: ; | contin: ; | contin: ; } | } while(...); | } -37- continue goto contin. ( contin: ; . . 0.13.). 6.10.  - return, return; return ; . - - . , - , , . - . , ( ). 6.11. goto - goto 1 (. 0.12), . 6.12.  , : : , - goto. , , . 6.13.  : ; , } - , while. -38-  * 7.  - . - extern ( ), , , static, . ; , int. , , , . - , , . 7.1.  _: _ -  _ _ , -, extern static; . , -  ..., , . _:  (_)   :  , _ _ _: _ _ . , , int. register; , - , , . : -39- int max(a, b, c) int a, b, c; { int m; m = (a>b) ? a:b; return((m>c) ? m:c); } int - -, ma(a,b,c) - _, int a,b,c; - - , { ... } - , . float - double, - , float, double. , ( ) - , -  ... -   ... , - , ( , , ). , , , . 7.2.  : _:  extern ( , ) static, auto register.  * 8.  - - ; . , . : , , , -40- , " "; -, - , , - . 8.1.  , , , . , , , . , , . , . - , - ; , . , , , , , - . , , , , , - , - , , . - , . , typedef, , - . , : typedef float distance; ... { auto int distance; ... int - , distance. -41- 8.2.  , extern, - , , . , , , , - , , . extern , - . , - - , extern, - . , - , extern. - , . . extern. , , , - . - . , static, . static. 8.3.  . . , , , int; , , - auto. - , auto ( - ); ,  ..., - extern. , (, -42- ,  int. /* extern */ int tab[100]; static /* int */ t1; /* int */ func(i) /* int i; */ { register /* int */ k; /* auto */ char buf[512]; /* extern int f1(); */ ... f1(a,b) ...  * 9. '' , - , . , #, a. ; ( ) . , , (, -77). 9.1.  #define  _ ( ) , - . #define (- ,...,) _ "(" , - . , "(", - ")", . , - , - . - , - ; , , - . . - . -43- , - . - , "\". - " ", , , #define TABSIZE 100 int table[TABSIZE]; : #define max(a,b) ((a)>(b)?(a):(b)) x = max(y,20) ( a b , , - . #undef  - . #define, , cc. 9.2.  #include "filename" - filename. , "" , - . #include <filename> . /usr/include. #include . -44- 9.3.  #if   , - . : #ifdef  , , .. #define. : #ifndef  , . - , #else : #endif , #else #endif . , #else , #else, #endif . . : #ifdef DEBUG fprintf(stderr,"i=%o j=%d\n",i,j); #endif , . 9.4. #line , -, : #line  "_" -45- ( - ), , , _. _ , . : #line 250 "gram.y"  * 10.  , - . 10.1.  - : ( .), ( &), - , , . - . CM- : , , - , . - , - , ; - , ; . "" , ( . ->) , - . , - . . l_ , l_ , - . , , ->, . , , . , . . -46- 10.2.  : . , , . , , int f(); ... g(f); g : g(funcp) int (*funcp)(); { ... (*funcp)(); ... } , f , g(f) "(". 10.3. ,  , , , , - . - l_. "[]" , e1[e2] *((e1)+(e2)). - , +, e1 - , e2 - , e1[e2] e2- e1. , , . . e n- i*j*...*k, e (n-1)- j*...*k. - * , , , , (n-1)- , - . , , : int u[3][5]; u - 3*5. -47- u - 5 . u[i], *(u+i), u , ; i u, i , , 5 . , ( 5 ), . , ; . , ( ) - , , , . 10.4.  - . - . . - , . int long, ( int). -, , . . . - - , -. - . - , , . , , . , alloc , ; - . -48- extern char *alloc(); double *dp; dp=(double*) alloc(sizeof(double)); *dp=22.0/7.0; alloc (- - ), - double; - . CM- 16- . char ; .  * 11.  , : - case, - . , sizeof, + - * / . % & | ^ << >> == 1= <> <= >= - ~ ?: , . ( ) ; & - , . & , . , , - .  * 12.  , -49- , , UNIX - . , - , , - , -. - , . , , , , . - - . , , ( - ) , , , . _ . register, , , . ; . , - . , , - . ; CM- PDP- 11 VAXR-11 DEC . , , . - int, - , . , - , , , - _. . - , (- , , int char ), . -50- , , . - , CM- , , "unsigned char" - , . 12.1.  - . - , , - . - =, =, ,  =-1  , = - - , -1 . : , , - , int  = 1; int  1; _ int f (1+2) , .  * 13.  / . " - /", , / - - . , - . , - " -51- ", . , "- " , - , , , - , - , . / , - /. ( 4) - ("man(3)"). , , / , , . 13.1.  , , #include <stdio.h> stdio.h , /. 13.2.  " " ( - ) getchar. getchar() . , , "<". prog getchar, prog <infile , prog infile, . , prog ; "<infile" (. ). - , - . , otherprog | prog , otherprog prog, , -52- prog other- prog. getchar EOF, - , . EOF -1 ( #define stdio.h), EOF, -1, - . putchar(c), 'c' " ", . - ">". prog putchar, prog > outfile outfile, . - . / "" getchar putchar . - . 13.3. - printf : printf scanf (- ) . . printf(control, arg1, arg2, ...) , control, . : , - , , - printf. "%" (, - ). "%" - : - , - . -53- - , . - , , . , , ( , - ) . , , ( ). - , . - (); , , float double. - l, , - long, int. : d - ; o - ( ); x - - ( 0); u - ; c - ; s - : , , - ; e - , float double, [-]m.nnnnnne[+-], n - . 6; f - , float double, [-]mmm.nnnnn, n - . 6. -54- , f ; g - %e %f, ; - . "ld" "D", "lo" - "O", "lx" - "X". % - , ; , % , %%. . , - . - "hello, world" (12 - ). , . :%10s: :hello, world: :%10-s: :hello, world: :%20s: : hello,