.


:




:

































 

 

 

 


: .




(4 )

, , , . :

;

, ;

.

, .

. , , . , . * . *, , , .

: int *ptr;

ptr . void . ,

void *x;

int *y;

y=x;

:

* _

, , * ( ) &.

* , _, - *_. ,

*ptr=value;

: value , ptr. . , . , void . , , . . *.

value=*ptr; : value , , ptr.

& . . :

=& ;

, , , .

.

NULL. , , . , , .

:

#include<stdio.h>

void main(){

int *x, *w;

int y, z;

*x=16;

y=-15;

w=&y;

printf(\n x=%d, sizeof(x));

printf(\n x=%u, x);

printf(\n =%d, *x);

printf(\n y=%u, &y);

printf(\n z=%u, &z);

printf(\n *w=%d, *w);

}

, (). , , , .. & _ [0].

:

_ [ _ ];

_ , . _ . , .

, , , . . , , , .

. , alloc.h stdlib.h ( alloc.h ). . malloc(), calloc() realloc() . void*. ( ) ( *). free() , calloc(), mailoc() realloc(). free() void*. void * , void * .

.

 
malloc void * malloc (unsigned s); () s . NULL.    
calloc void * calloc (unsigned n, unsigned m); () , n m . NULL.  
realloc void * realloc (void * bl, unsigned ns); ns . bl . bl NULL ( ), malloc.  
free void * free (void * bl); () , bl  

(malloc) (free) . : , , . :

#include <stdio.h>

#include <stdlib.h>

void main (){

/* */

float *t;

int i, n;

printf ("\nn="); /* n - */

scanf ("%d",&n);

t= (float *)malloc(n*sizeof (float));

for{i=0; i<n; i++) /* */

{ printf ("x[%d]=",i);

scanf ("%f", fit [i]); }

/* */

for(i=n-l; i>=0; i --){

if(i%2== 0)printf ("\n"); printf ("\tx[%d]=%f",i,t[i];

}free (t); /* */}

int n float, t , n . t , n float. (float*) , malloc(). : t[i] t[i-l]. . free(t); , t.





:


: 2016-03-28; !; : 646 |


:

:

- , - .
==> ...

1424 - | 1353 -


© 2015-2024 lektsii.org - -

: 0.041 .