C++ (, char, int, short int, long int, unsigned char, float, double ..; : * , [ ] , () ), .
!!! . , , .
( ) ( ). . , . .
type [];
type.
:
double M[10]; // 10 double (M[0], M[1], M[9])
int m [5]; // 5 int
type1 (type2);
, type2 type1.
:
int main (); // main,
// int.
void f1 (double); // f1, double
// .
type1 *(type2);
, type2 type1.
:
int *fp (float); // fp, float
// int.
char * fun () // fun,
//
type *;
type.
:
int * tr; // tr int.
type **;
type.
:
int ** ptr; ptr int
type *[];
type.
:
int * mtr[ 5 ]; // mtr 5 int.
type (*)[];
type.
:
int (* tr) [ 5 ]; // tr 5 int.
double (*pm) [10]; // pm 10 double
type1 *(*) (type2);
, type2 type1.
:
int ( * pf) (); // pf ,
// int
double * (*pfp)(int); // pfp ,
// int double
char (* fun)() // fun ,
//
type1 (&) (type2);
, type2 type1.
struct {
type1 1;
type2 2;
};
( 1 2), type1 type2.
|
|
union {
type1 1;
type2 2;
};
- ( 1 2), type1 type2.
class {
type1 1;
type2 2;
type3 3(type4);
};
( 1 2 3).
// pf ,
//
// 20 int
int * (* (*pf) ()) [20]; // pf ,
//
// 20 int
-, :
1. ;
2. ;
3. ( , , .. *);
4. .2 3 , ;
5. .
-:
int *(*(*per)())[20];
1. . *per, .. per .
2. , , . (), .. .
3. . *, .. .
4. . [20], .. 20 .
5. . *, .. .
6. , , , . int, .. .
7. , , per , 20 , .
, .. . (() , [ ] ) (*).
:
1. .
2. , .
3. , .. , .
4. , .. , :
) .3 , ;
b) , .
5. .3 4 .
6. .
|
|
++ , . : , , , , .
, ab. : ab[ ]. : *ab[ ], : (*ab[ ])(). : *(*ab[ ])(). . : int *(*ab [ ]) ();