9
: .
1.
3.1. , .
3.2. .
3.3. , .
3.4. . .
2.
. , .
3.
1) .
2) .
3) .
4) . .
5) (- ).
6) .
7) .
8) .
9) .
4.
1) .
Struct Matr {
int m, n;
int * ptr;
};
' , , .
2) .
Struct Matr2 {
int m, n;
int ** ptr;
};
' , , .
3) .
Struct Matr {
int m, n;
int * ptr;
};
' , , .
4) .
Struct Matr2 {
int m, n;
int ** ptr;
};
' , , .
5) .
Struct Matr {
int m, n;
int * ptr;
};
' , , .
6) .
Struct Matr2 {
int m, n;
int ** ptr;
};
' , , .
7) .
Struct Matr {
int m, n;
int * ptr;
};
' , , .
8) .
Struct Matr2 {
int m, n;
int ** ptr;
};
' , , .
- ?
- ?
- ?
- ?
- ?
- ++, [MxN], . : M,N. : .
- ++, [MxN. : M,N matr. : , matr = 0.
- new?
- delete?
- ?
) int mas= new int[7];
|
|
) int* mas = new int*[9];
) int R=9; int * mas = &R; delete mas;
' ' . . , .
'
void * malloc (size_t size);
size . size_t unsigned int. , 64K. , NULL.
'
void free (void * block);
, block. 䳿 , , .
'
main () {
float ** A;
int n = 5, n = 10;
A = (float **) malloc (m * sizeof (float *));
if (A == NULL)
{
printf ("\ n ' !");
exit (1);
}
for (int i = 0; i <m; i + +)
{
A [i] = (float *) malloc (n * sizeof (float));
if (A [i] == NULL)
{
printf ("\ n ' % d- !", i);
for (int j = 0; j <i; j + +)
free (A [j]);
free (A);
exit (2);
}
/ /.......
for (i = 0; i <m; i + +)
free (A [i]);
free (A);
}