You are on page 1of 17

bytes

) ( pointers

( ).


* ) ( asterisk .

x int p ( int
) . .

. .

& ( x
) x x .

) 0111 ( x . p
x x
.

x p * .

* :
)0 .
)2
.

x & . p

%p .
.. ...

p 0110 .

:
)0 ) . ( Dynamic memory allocation
)2
.
)3 .

.

Stack / Heap

stack . heap

. RAM .

heap ( ) refrences . stack

Stack Heap
stack heap
.

stack LIFO Last Input First Output


stack . Heap

.

stack . heap


.
:
)0 " " .
)2 stack
stack overflow crash
.
)3 stack
. heap

Dynamic Memory Allocation


stack heap
( . ) pointers


" " .

& .
.

= . 1000
.

0110 0111
.

structure Dynamic memory


allocation .

Structure
char int ""
.. ... ..
. structures
human .

" " human


.
.

.
.
.


strcpy name
assignment . String
human
.
mahmoud .



( human ) human
( * ) .

pstruct , human
( human ) mahmoud
.

pstruct mahmoud .

*
* .

age mahmoud pstruct


.


calloc malloc stdlib.h
include . malloc

malloc
built-in int .. char
user-defined mahmoud human .

sizeof .
malloc * void
casting .

int .

int malloc
int 4 casting
25 * .

human .

>. -

calloc
calloc
.

calloc .

calloc malloc .

] pnum[i
.

( ) . calloc


calloc
.

employee ( )
.

pemp . employee

employee . n

You might also like