Info2/2008tavasz/kuka
A MathWikiből
A lap korábbi változatát látod, amilyen Wettl (vitalap | szerkesztései) 2008. február 14., 20:20-kor történt szerkesztése után volt.
A nyelv
- Története
- C programozási nyelv: Dennis Ritchie 1972, Bell Telephone Laboratories
- K&R C 1978
- ANSI (American National Standards Institute) 1989 -> C89
- ISO (International Organization for Standardization) ISO/IEC 9899:1990 -> C90 (lényegében azonos)
- ISO 9899:1999 (ANSI 2000) -> C99
- hatás, utódok: C++, Java, perl, C#
- Tulajdonságai
- általános célú, blokkstruktúrált, imperatív (utasításokból áll, melyek megváltoztatják a program állapotát), procedurális (az előbbi megvalósítása eljáráshívásokkal) nyelv
- Unixra készült, ma szinte minden platformon
- rendszerprogramok, beágyazott rendszerek, alkalmazási programok
- alacsony szintű memóriahozzáférés, hatékonyan fordul gépi kódra
- támogatja a gépfüggetlen programozást
Művelet | Leírás | Asszociativitás |
---|---|---|
++ -- () [] . -> typeid() const_cast dynamic_cast reinterpret_cast static_cast
|
Postfix increment and decrement Function call Array subscripting Element selection by reference Element selection through pointer Run-time type information (C++ only) Type cast (C++ only) Type cast (C++ only) | balról jobbra | |
++ -- + - ! ~ (type) * & sizeof new new[] delete delete[]
|
Prefix increment and decrement Unary plus and minus Logical NOT and bitwise NOT Type cast Indirection (dereference) Address-of (reference) Size-of Dynamic memory allocation (C++ only) Dynamic memory deallocation (C++ only) |
Right-to-Left |
.* ->*
|
Pointer to member (C++ only) | Left-to-Right |
* / %
|
Multiplication, division, and modulus (remainder) | |
+ -
|
Addition and subtraction | |
<< >>
|
Bitwise left shift and right shift | |
< <= > >=
|
Relational “less than” and “less than or equal to” Relational “greater than” and “greater than or equal to” | |
== !=
|
Relational “equal to” and “not equal to” | |
&
|
Bitwise AND | |
^
|
Bitwise XOR (exclusive or) | |
|
|
Bitwise OR (inclusive or) | |
&&
|
Logical AND | |
||
|
Logical OR | |
c?t:f
|
Ternary conditional (see ?:) | Right-to-Left |
= += -= *= /= %= <<= >>= &= ^= |=
|
Direct assignment Assignment by sum and difference Assignment by product, dividend, and remainder Assignment by bitwise left shift and right shift Assignment by bitwise AND, XOR, and OR | |
throw
|
Throw operator (exceptions throwing, C++ only) | Not available |
,
|
Comma | Left-to-Right |