.


:




:

































 

 

 

 


* , .

14

.

 

: , , , .

.

, . , . .

:

 

< > [ 1] [ 2].[ n];

 

:

< > [];

(int, float, char).

.

0. - 0. , int a [100], 100 a [0] a [99]. , .

N = < > * < >.

. : . int a[3][4] :

  Ho (j)
(i) A [0] [0] A [0] [1] A [0] [2] A [0] [3]
A [1] [0] A [1] [1] A [1] [2] A [1] [3]
A [2] [0] A [2] [1] A [2] [2] A [2] [3]

 

, . .

a [0] [0], a [0] [1], . a [0] [3], a [1] [0], a [1] [1], ..a [2] [3].

, , , , , . , .

.

.

float arr [6] = {1.1, 2.2, 3.3, 4.0, 5.0, 6}; //

int a [3] [5] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}

.

a[0] [0] = 1; a [0] [1] = 2; a [0] [2] = 3; a [0] [3] = 4

a [0] [4] = 5; a [0] [5] = 6; a [0] [6] = 7; a [0] [7] = 8 . .

, , , .

:

int a [3] [5] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};

int a [3] [5] = {{1, 2, 3, 4, 5}, {6, 7, 8, 9, 10}, {11, 12, 13, 14, 15}};

. . , .

:

int a [3] [5] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11};

int a [3] [5] = {{1, 2, 3}, {4, 5, 6, 7, 8}, {9, 10, 11}};

.

:

:

         
         
         

:

         
         
         

 

.

char str [15] = {B, o, r, l, a, n, d, , C, +, +};

:

hr str [15] = Borland C + +;

:

int mas [ ] = {1, 2, 3, 4, 5, 1, 2};

char str [ ] = ;

. . . , .

, . - . . , .

:

*< >;

:

char *ch;

int * temp, i, *j;

float * pf, f;

ch, temp, j, pf, i f float.

. & *. , . . , .

& .

* , .

, .. , . int 2 , char .. .

 

# include <stdio.h>

main ()

{

float x = 10.1, y;

float * pf;

pf = &x;

y = *pf;

printf(x = %f y= %f, x, y); // : x=10.1; y=10.1; pf=FFF6

*pf ++;

printf (x = %f y = %f, x, y); // : x=10.1; y=10.1; pf=FFF2

y =1+ *pf * y;

printf (x = %f y = %f, x, y); // : x=10.1; y=1; pf=FFF6

return 0;

}

. , .

# include <stdio.h>

main ()

{

int x = 0;

int *p, *g;

p = &x;

g = p;

printf(%p, p); /* p */

printf(%p, g); /* g */

printf(%d %d, x., *g); / * g */

}

printf() %p .

. int *pi; , , float,

p = &x;

, int float :

p = (int*)&x;

, .

.

:

int temp [365];

char arr [10];

char *point[10];

:

int array[4] [10];

char arr [3] [7];

[ ] , :

temp [365] 365 .

(), .. temp[0], temp[1],,temp[364]- . 0.

, : int arr [k] [l] [n];

, .

, . , . , . , : . , . , . . . , : 2 , - 4 ..

int mas[] int *mas : mas .

, .

int mas[10];

int *ptr;

ptr = mas; //

// :

mas[2] = 20;

*(ptr + 2) = 20;

// 2 :

*ptr + 2;

 

. .

int mas[4][2];

int *ptr;

ptr = mas;

ptr , ..

ptr = = mas = = &mas [0] [0];

:

ptr+1 = = &mas [0] [1];

ptr+2 = = &mas [1] [0];

ptr+3 = = &mas [1] [1] ..

. , . , mas[0],,mas[3]. - , .. mas[0]= =&mas[0] [0]. mas[i]? mas [i] i- , .. i - .

mas [0] == &mas [0] [0];

mas [1] == &mas [1] [0];

mas[2] == &mas [2] [0];

mas[3] == &mas [3] [0];



<== | ==>
_ variable; // | ( ).
:


: 2016-12-29; !; : 313 |


:

:

: , .
==> ...

1488 - | 1463 -


© 2015-2024 lektsii.org - -

: 0.02 .