printf() ( stdio.h) . :
rintf ("< >", _1, _2,...);
: , ( ); , ; .
% , . % :
% [] [_] [] [F|N|h|l|L] c_n
c_n ( ) :
11.
printf()
; | |
d i | ; |
1.23e+2; | |
1.23E+2; | |
f | ; |
g ( G) | , f, ; |
; | |
s | ( , , , ); |
u | ; |
0,..., 9, , b, , d, , f; | |
X | 0,..., 9, , , , , , F; |
; | |
n | . , , . ( ), %n. |
:
(-) , ;
(+) ;
, ( ). *, ;
(.), ;
, , , float double ();
F, far;
N, near;
|
|
h, short int ( d, i, , u, , );
l, , long ( d, i, , u, , X) double ( , , f, g, G);
L, , long double ( , , f, g, G);
#, g, f, . , - 0x .
% , . , %% %.
printf() , , , . , , , ; , .
, , , .
:
12.
printf()
\ | ; |
\b | ; |
\f | ; |
\n | ; |
\r | ; |
\t | ; |
\v | ; |
\\ | \; |
\' | '; |
\" | "; |
\? | ?. |
22. printf() (\t), .. , Computer, (\n), i %d ( ), , , (\n).
int i=100;
printf("\tComputer\n%d\n", i);
:
Computer¿
100¿
¿
:
( );
, ;
.
, .
, , , . , .
. , . , . , , .
|
|
, long int unsigned long int float, .
. . .
, . , , , ( 1), .. , .
, signed long, signed long . unsigned long float, double long double , , , long.
. float double . double long double float c . float, , .
. long ( ), long . long, .
float, double long double unsigned long , , , long.
. . - .
void , void . . :
, , ;
, , , , .
:
, , ( );
, ( , ), .
. , , , ( "") .
, .
. float double, char short int, unsigned char unsigned short unsigned int. . , .
|
|
. , :
(< >)
< > , .
23. i,l,d .
int i=2;
long l=2;
double d;
float f;
d=(double)i * (double)l;
f=(float)d;
, . "=" .
1 = <>;
2 = { < > };
1 , 2 - .
24. .
char tol = 'N'; // tol 'N'.
const long megabute = (1024 * 1024); /* megabute
,
.*/
static int b[2][2] = {1,2,3,4}; /* b
,
.*/
static int b[2][2] = {{1,2},{3,4}}; /*
.*/
static int b[3[] = {{1,2},{3,4}}; /*
.*/
static int b[2][2] = {{1,2},{3}}; /*
,
0,
..
1 2, 3 0.*/
, .
25. comp , real imag.
struct complex
{
double real;
double imag;
} comp [2][3] = {{{1,1},{2,3},{4,5}},{{6,7},{8,9},{10,11}}};
struct complex comp2 [2][3] = {{1,1},{2,3},{4,5}, {6,7},{8,9},{10,11}};
:
- comp2;
- comp2[0]. 1,1 ;
( 1) , , comp[0] ;
{2,3} comp[1], ;
{4,5} 3 comp2 .
.
26. pers.name.
union tab
{
unsigned char name[10];
int tab1;
} pers = {'A','H','T','O','H'};
, . , .
|
|
.
char stroka[] = "";
7 , () '\0', .
, , , , .
stroka , .
char stroka[5] = "";
stroka , '' '\0' .
, , .
8.
, , .