.


:




:

































 

 

 

 





 

:

o , extern, ;

O , , ;

O static . . , ;

O auto register , . , ;

O static . , . auto register .

, ( ) . , char , int , . - .

 

C.

:

, ;

;

;

( , ).

, , , . ; , , .

, . , , . , . , * () .

:

*;

, , ,

int *p1;

, . , int *, , , , int, . , , , , .

 

. C , :

&p , p . p.

:

# include <stdio.h>

int main()

{

int x=2,*p;

p=&x;

printf("\n x=%d address of x=%u",x,p);

return 0;

}

 

*, , : * , -. , , , .

ptr=&a; val=*ptr; val=a;

,

n=32;

p=&n; /* p , n */

v=*p;

v 32.

 

 

5 :

 

: &p, p (&p , ).

. p=&q, p , q .

, : *p ( ).

() . (+), (++). () ().

, p1 , 1++ :

o 1 , *p1 char;

o 4 , *p1 int ( 32 ) 2 ( 16 );

o 4 , *p1 float.

. 1 2 . 1 2, , .

 

:

&a=63384,&b=64390,&c=64404. ?

# include <stdio.h>

int main()

{

float a,*p1;

int b,*p2;

char c,*p3;

a=2.5; b=3; c='A';

p1=&a; p2=&b; p3=&c;

p1++; p2++; p3++;

printf("\n p1=%u, p2=%u, p3=%u",p1,p2,p3);

return 0;

}

: 1=63388, 2=64392, 3=64405.

 

. - 1 . . , , . , .

char , char 1.

() (). , , .

, , . , . , C . , , , , .





:


: 2016-12-17; !; : 378 |


:

:

- , , .
==> ...

1565 - | 1369 -


© 2015-2024 lektsii.org - -

: 0.015 .