C : () () . () , . , (short), (long) (unsigned). , (struct), (union), (enum).
.
, (0...9), (A...Z) (a...z) , (_). . (a.z) (A .Z), .. PI, Pi pi . , . C (). - .
:
- ;
- , ;
- ( ).
- , /* */ // .
: putchar() . puts() . printf() . : rintf (< >, < >);
getch () . gets () ENTER. scanf .
5 .
: 1) : _=;
, _. o ,: x=y=z=0; 2) :
_ =e; (+, -, *, /, %);
. .
: < (), <= ( ), > (), >= ( ), != ( ), = = (). = =,!=, <=, >= . : <_1> <_> <_2> . . , . :! ( ), && ( ), || ( ). && || .
|
|
8 if, if/else
if . : if () 1; else 2;
: if(x>y) max=x;
else max=y;
1 2 , {}, .. . if . ( 0), 1, , (=0), 2. (else 2;) . . if . 1 2 if, . else if. if: if (1) 1; else if(2) 2; else 3;
switch
Switch . :
switch ()
{
case consnant1: ;
break;
case consnantN: ;
break;
default: ;
}
consnant1consnantN - ; default - , ; ; break -o switch. case . break , case. switch , , . , .
For
for : for (_1; _2; _3) ;
_1 ;
_2 ;
_3 ( );
.
: _1, _2, - , , , , _2 .
While
while: while () ;
, .
, , .. . , . while , 0.
13 do/while
do while:
Do
;
|
|
While ();
, .
dowhile , .. , . dowhile , .
Continue, break
break; - . , break, ;
continue, , .. .
15 . /
. . ( ), . 0. : <> < >[]; , . . , . : int a[5]; [0], [1], , - [4]. .
PASCAL , string. . char, .. char, . , , ´ \0 ´( -). , k , k+1 .