.


:




:

































 

 

 

 


'

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;

};

' , , .

 

  1. ?
  2. ?
  3. ?
  4. ?
  5. ?
  6. ++, [MxN], . : M,N. : .
  7. ++, [MxN. : M,N matr. : , matr = 0.
  8. new?
  9. delete?
  10. ?

) 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);

}

 



<== | ==>
i , i i |
:


: 2017-04-04; !; : 780 |


:

:

.
==> ...

1851 - | 1705 -


© 2015-2024 lektsii.org - -

: 0.011 .