GNU Free Documentation License . .

( )

( «C ( )»)
: ,
:

:

:

19691973

():

,

:

.c - , .h -

:

:

GCC, TCC, Turbo C, Watcom, Oracle Solaris Studio C

:

«K&R» C (1978)
ANSI C (1989)
C90 (1990)
C99 (1999)
C11 (2011)

(. C , 1970- Bell Labs . UNIX. . . . . , , . .

, , .

[]

[]

. , , , . , , . . , . « » « », , . , , . , , .

. (, , ). , , . , , .

( UNIX, ) , . , .

: , , , . :

  • , , ;
  • , ;
  • , ;
  • , , ;
  • ;
  • ;
  • , ( );
  • ;
  •     , ;

, :

, , , . , , . , , , .

, , .

[]

89 32 :

auto double int struct
break else long switch
case enum register typedef
char extern return union
const float short unsigned
continue for signed void
default goto sizeof volatile
do if static while

C99 :

_Bool
inline
_Complex
_Imaginary
restrict

[] «Hello, world!»

, « » , . «Hello, world!» (, , , , - , , ).

 main() {  printf("Hello, World!\n");  }

, , ANSI C. , , C99, int , ( main ). , :

#include <stdio.h>
int main(void)
{
    printf("Hello, World!\n");
    return 0;
}

#include, , , . stdio.h. stdio.h .

main. , . int , main . main .

«» printf. stdio.h , , . , "Hello, World!\n. \n « », . printf int, ( ).

return (main ), , return ( 0).   main, , . main. C99, return 0 main ( return main return 0;).

[]

, /* */ ( ), . . , C99, , //

[]

, , . (short int, long int), (signed) (unsigned), (float, double), , (enum) - (struct). , (union), , ( ), , ( - , ).

, . . . , lint.[1]

[]

, .

( ) :

  • : ; . « » (. undefined behaviour). .
  • : ; , , , .
  • : malloc, realloc, calloc free , . free.

. , ,   , , . , , . , . .

, , : , , , . , , - , , .   .

[]

ASCII, ( $ @ `).   , , (), (), [], {}. , , .

[]

, . : «  , , : , ». , . . . , .

. , , ( ). , , , , . . .

. , , . , , , ; , , . , , , ( )  «». , , , , «» (garbage), , « » . .

, , . , , , . , . , .

, , free(). , , . . , , . - , -, . . , , C++, , C99.

. , , . , , . , printf , , , . , printf, , . , printf, , .

. , , , , .

[]

[]

Bell Labs 1969 1973 . , 1972 . «» (C  ), «» (B  ). . BCPL, Bon, , .

, UNIX, :

1973 , UNIX, PDP-11/20, . , , ; Multics ( /1) TRIPOS ( BCPL).

[] K&R C

1978 « ». , «K&R», . , , «K&R C». ( ANSI C, .)

K&R :

  • ( struct);
  • ( long int);
  • ( unsigned int);
  • += ( =+ , , i =+ 10 i = +10).

K&R C , . ANSI C, , , , ANSI C, K&R C ANSI C.

K&R C , AT&T :

  • , ( void) , ( void *);
  • , ;
  • ;
  • ;
  • (const);
  • , , ;
  • (enum);
  • (float).

[] ISO C

1970- . 1980- IBM PC, . Bell Labs - . , , C++, , [2] , UNIX- .

1983 (ANSI) . 1989 « » ANSI X3.159-1989. ANSI C C89. 1990 ANSI C (ISO) ISO/IEC 9899:1990.

K&R C, , . , ( C++) .

ANSI C . , , ANSI C. , , , . , , , :

  1. , , ;
  2. - ;
  3. .

[] C99

ANSI , ++ ( 1995 , ). 1990- , ISO 9899:1999 1999 . «C99». 2000 ANSI.

C99:

  • (inline);
  • ( C++);
  • , long long int ( 32- 64- ), _Bool complex ;
  • ;
  • (restrict);
  • : struct { int x, y, z; } point = { .y=10, .z=20, .x=30 };
  • , //, C++ ( );
  • , snprintf;
  • , stdint.h.

C99 [?] . GCC[3], Sun Microsystems C99, Borland Microsoft , , , .

[] C11

8 2011 (ISO/IEC 9899:2011)[4]. GCC[5] Clang[6]. :

  • ;
  • ;
  • (type-generic expressions, );
  • ( );
  • ;
  • (static assertions);
  • gets ( gets_s);
  • quick_exit;
  • _Noreturn;
  • .

[] C++

C++ . C++ , . C99 C++ . , C++, , , , .

, C++, C++ . , C++ , , . , .

, [?]:

  • inline  C++,   ( ). , , C++ ( ) , , . - .
  • C++, bool C99 stdbool.h. C99 _Bool. (C89) , ( , ) .
  • ( ) : int char C++. sizeof('a') == sizeof(int), C++  sizeof('a') == sizeof(char).[7]
  • C99, , restrict, C++.

C++ :

  • ;
  • , // ;
  • , void, const int .

[]

« C» . , . ISBN 5-9518-0048-X

,
, 16
a[k] 16
f() 16
. 16
-> 16
++ -- 16
( ) {init} (C99) 16
++ -- 15
sizeof 15
~ 15
! 15
- + , 15
& 15
* () 15
( ) 14
* / % 13
+ - 12
<< >> 11
< > <= >= 10
== != / 9
& 8
^ 7
| 6
&& 5
|| 4
? : 3
= += -= *= /= %= <<= >>= &= ^= |= 2
, 1

[] [8]

[]

, , , , , - , .

:

[] .

[]

[]

[]

  • WG14 N1124  (.). ISO/IEC 9899 Programming languages C Approved standards. ISO/IEC JTC1/SC22/WG14 (6 2005).  ISO/IEC 9899:1999 (C99) + ISO/IEC 9899:1999 Cor. 1:2001(E) (TC1 Technical Corrigendum 1 2001 ) + ISO/IEC 9899:1999 Cor. 2:2004(E) (TC2 Technical Corrigendum 2 2004 ). 22 2011. 20 2009.
  • C The ISO Standard Rationale, Revision 5.10  (.) ( 2004).  C99. 22 2011. 20 2009.