Uploaded by grigoru13

C types

advertisement
C integer types
Type
Storage size
Value range
char
1 byte
-128 to 127 or 0 to 255
unsigned char
1 byte
0 to 255
signed char
1 byte
-128 to 127
int
2 or 4 bytes
-32,768 to 32,767 or 2,147,483,648 to 2,147,483,647
unsigned int
2 or 4 bytes
0 to 65,536 or 0 to
4,294,967,295
short
2 bytes
-32,768 to 32,767
unsigned short
2 bytes
0 to 65,536
long
4 bytes
-2,147,483,648 to
2,147,483,647
unsigned long
4 bytes
0 to 4,294,967,295
C (moji c no/ si c/ ) wa, seitekina-gata shisutemu de kōzōkapuroguramingu, jiku hensū no sukōpu,
oyobi saiki o sapōto suru han'yō no tetsudzuki-gata konpyūtāpuroguramingu gengodesu. Sekkei-jō,
C wa ippantekina kikaigo meirei ni kōritsu-teki ni mappu suru kōsei o teikyō shimasu. Izen ni
asenburi gengo de kōdingu sa reta apurikēshon de eizoku-teki ni shiyō sa rete imasu. Ko no yōna
apurikēshon ni wa, sūpākonpyūtā kara PLC ya kumikomi shisutemu made, konpyūtāākitekuchā-yō
no operētingushisutemu ya samazamana apurikēshonsofutou~ea ga fukuma remasu. Puroguramingu
gengo B, C no kōkei wa, Unix-jō de jikkō sa reru yūtiriti o kōchiku suru tame ni, 1972-nen kara
1973-nen no ma ni denisu Ritchie ni yotte Bell Labs de saisho ni kaihatsu sa remashita. Unix
operētingushisutemu no kāneru no sai jissō ni tekiyō sa remashita. [5 ] 1980-Nendai, C wa jojoni
ninki o hakushimashita. Kore wa, mottomo hiroku shiyō sa rete iru puroguramingu gengo no 1tsu ni
nari [6 ] [7 ], kizon no konpyūtaākitekucha to operētingushisutemu no daibubun de shiyō dekiru
samazamana bendā no C konpaira o sonaete imasu. C wa, 1989-nen irai anshī (anshī C)oyobi
kokusaihyōjunkakikō (aiesuō) ni yotte hyōjun-ka sa rete imasu. C wa hissu no
tetsudzukigatagengodesu. Saishōgen no rantaimusapōto de, mashin meirei ni kōritsu-teki ni mappu
suru memori oyobi gengo kōzō e no tei reberu no akusesu o teikyō suru yō ni konpairu sa reru yō ni
sekkei sa remashita. Tei reberu no kinō nimokakawarazu, kono gengo wa
kurosupurattofōmupuroguramingu o sokushin suru yō ni sekkei sa rete imasu. Ishoku-sei o kōryo
shite sakusei sa reta hyōjun junkyo no C puroguramu wa, sōsukōdo o hotondo henkō suru koto
naku, samazamana konpyūtāpurattofōmu oyobi operētingushisutemu-yō ni konpairu dekimasu.
Mokuji 1. Gaiyō 1. 1 Hoka no gengo to no kankei 2 rekishi 2. 1 Shoki no kaihatsu 2. 2 K& R C 2. 3
Anshī C oyobi aiesuō C 2. 4 C 99 2. 5 C 11 2. 6 C 18 2. 7 C 2 x 2. 8 Kumikomi C 3 kōbun 3. 1 Moji
setto 3. 2 Yoyaku-go 3. 3 Operētā 4 `haro, world' no rei 5 dēta-gata 5. 1 Pointa 5. 2 Hairetsu 5. 3
Hairetsu to pointa no gokansei 6 memori kanri 7 raiburari 7. 1 Fairu no shori to sutorīmu 8 gengo
tsūru 9 yōto 10 kanren gengo 11 sanshō 12 chūshaku 13 sankō bunken 14 sōsu 15 sarani yomu 16
gaibu rinku gaikan Denisu ritchī (migi), C puroguramingu gengo no hatsumei-sha, Ken Tonpuson
arugoru no dentō ni aru hotondo no tetsudzukigatagengo to dōyō ni, C ni wa kōzōkapuroguramingu
no kinō ga ari, jiku hensū no sukōpu to saiki ga kanōdesu. Sono seiteki-gata shisutemu wa, ito
shinai sōsa o bōshi shimasu. Cde wa, subete no jikkō kanō kōdo wa saburūchin-nai ni fukuma rete
imasu (genmitsu ni wa kansūkei puroguramingu to iu imide wa arimasenga,`kansū'-tomo yoba
remasu). Kansū paramētā wa tsuneni atai de watasa remasu. Sanshō watashi wa, meishiteki ni
pointā-chi o watasu koto ni yotte C de shimyurēto sa remasu. C puroguramu no sōsutekisuto wa
jiyū keishiki de, semikoron o sutētomento no tāminētā to shite shiyō shi, sutētomento no burokku o
gurūpu-ka suru tame ni nakakakko o shiyō shimasu. C gengo ni wa,-ji no tokusei mo arimasu. Kono
gengo ni wa, kotei sa reta shōsū no kīwādo ga ari, if/ else, fō, do/ while, while, suitchi nado no
seigyo furōpurimitibu no kanzen'na setto ga fukuma rete imasu. Yūzā teigi no namae wa, arayuru
shurui no shigiru ni yotte kīwādo to kubetsu sa remasen. +,+ =,++,&,|| Nado no tasū no sanjutsu
enzanshi, bitto tan'i enzanshi, ronri enzanshi ga arimasu. 1Tsu no sutētomento de fukusū no wariate
o jikkō dekimasu. Kansū: Kansū no modori-chi wa, fuyōna baai wa mushi dekimasu. Kansū pointa
to dētapointa ni yori, adohokkurantaimu no porimōfizumu ga kanō ni narimasu. Kansū wa, hoka no
kansū no jiku sukōpu-naide wa teigi dekimasen. Dēta no kata shitei wa seitekidesuga, kyōsei wa
yowaku natte imasu. Subete no dēta ni wa taipu ga arimasuga, anmoku-tekina henkan ga kanōdesu.
Sengen kōbun wa shiyō-hō no kontekisuto o mohō shite imasu. C ni wa `teigi' kīwādo wa arimasen.
Kawari ni,-gata no namae de hajimaru sutētomento ga sengen to shite atsukawa remasu. `Kansū'
kīwādo wa arimasen. Kawari ni, kansū wa kakko de kakoma reta hikisū risuto no sonzai ni yotte
shimesa remasu. Yūzā teigi (typedef)oyobi fukugō taipu ga kanōdesu. Ishu no shūkei dēta-gata
(kōzōtai) o shiyō suru to, kanren suru dēta yōso ni akusesu shite, 1tsu no tan'i to shite wariateru
koto ga dekimasu. Yunion wa menbā ga jūfuku suru kōzōdesu. Hokan sa reta saigo no menbā nomi
ga yūkōdesu. Hairetsu no sakuin-tsuke wa, pointā enzan no kanten kara teigi sa reta 2-ji hyōkidesu.
Kōzōtai to wa kotonari, hairetsu wa fāsutokurasu no obujekutode wa arimasen. Tan'itsu no
kumikomi enzanshi o shiyō shite wariate tari hikaku shi tari suru koto wa dekimasen. Shiyō matawa
teigi sa rete iru `hairetsu' kīwādo wa arimasen. Kawari ni, kakukakko wa hairetsu o kōbun-teki ni
shimeshimasu (rei: Month [11] ). Enum kīwādo o shiyō suru to, rekkyo-gata o shiyō dekimasu.
Sorera wa seisū to jiyū ni sōgo henkan dekimasu. Mojiretsu wa meikakuna dēta-gatade wa
arimasenga, jūrai wa null de shūryō suru moji hairetsu to shite jissō sa rete imasu. Konbāchin ni
yori konpyūtamemori e no tei reberu no akusesu ga kanō
Развернуть
2660/5000
C (letter c/sic/) is a general-purpose procedural computer programming language that supports
structured programming, lexical variable scope, and recursion in a static type system. By design, C
provides a configuration that efficiently maps to common machine instructions. Permanently used
by applications previously coded in assembly language. Such applications include operating
systems and various application software for computer architectures, from supercomputers to PLCs
and embedded systems.
Successors of the programming languages B, C were first developed at Bell Labs by Dennis Ritchie
between 1972 and 1973 to build utilities that run on Unix. Applied to the reimplementation of the
Unix operating system kernel. [5] In the 1980s, C gradually became popular. It has become one of
the most widely used programming languages [6] [7], with C compilers from various vendors
available for most existing computer architectures and operating systems. C has been standardized
by ANSI (ANSI C) and the International Organization for Standardization (ISO) since 1989.
C is a mandatory procedural language. Designed to be compiled to provide low-level access to
memory and language constructs that map efficiently to machine instructions with minimal runtime
support. Despite its low level features, this language is designed to facilitate cross-platform
programming. Built for portability, standards-compliant C programs can be compiled for different
computer platforms and operating systems with little modification to the source code.
table of contents
1. Overview
1.1 Relationship with other languages
2 History
2.1 Initial development
2.2 K & R C
2.3 ANSI C and ISO C
2.4 C99
2.5 C11
2.6 C18
2.7 C2x
2.8 Embedded C
3 syntax
3.1 Character set
3.2 Reserved words
3.3 Operator
4 "Hello, world" example
5 data types
5.1 Pointer
5.2 Array
5.3 Array and pointer compatibility
6 memory management
7 Library
7.1 File Processing and Streams
8 language tools
9 applications
10 Related languages
See 11
12 comments
13 References
14 sources
15 Read more
16 external links
Overview
Dennis Ritchie (right), Ken Thompson, inventor of the C programming language
Like most procedural languages in ALGOL's tradition, C has structured programming capabilities
that allow lexical variable scope and recursion. Its static type system prevents unintended
operations. In C, all executable code is contained within subroutines (not strictly functional
programming, but also called "functions"). Function parameters are always passed by value.
Passing by reference is simulated in C by explicitly passing a pointer value. The source text of the C
program is free-form, using semicolons as statement terminators, and curly braces to group blocks
of statements.
The C language also has the following characteristics:
The language has a small number of fixed keywords and includes a complete set of control flow
primitives such as if/else, for, do/while, while, and switch. User-defined names are not distinguished
from keywords by any kind of sigil.
There are many arithmetic, bitwise, and logical operators such as +, + =, ++, &, ||.
You can make multiple assignments with a single statement.
function:
The return value of the function can be ignored if it is not needed.
Function and data pointers enable ad hoc runtime polymorphism.
Functions cannot be defined within the lexical scope of other functions.
Data typing is static, but coercion is weak. All data has a type, but implicit conversion is possible.
The declarative syntax mimics the usage context. There is no "definition" keyword in C. Instead,
the statements that begin with the type name are treated as declarations. There is no "function"
keyword. Instead, the function is indicated by the presence of the argument list in parentheses.
User defined (typedef) and complex types are possible.
Heterogeneous aggregate data types (structures) allow you to access related data elements and
assign them as a unit.
Union is a structure with overlapping members. Only the last member saved is valid.
Array indexing is a quadratic notation defined in terms of pointer arithmetic. Arrays, unlike
structs, are not first-class objects. It cannot be assigned or compared using the single built-in
operator. There are no "array" keywords used or defined. Instead, the brackets indicate the array
syntactically (eg month [11]).
You can use enums with the enum keyword. They can be freely interconverted with integers.
Strings are not a well-defined data type, but are traditionally implemented as null-terminated
character arrays.
Convertin allows low level access to computer memory
Отправить отзыв
История
Сохранено
Сообщества
Download