-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.c
59 lines (42 loc) · 860 Bytes
/
main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/*
19.02.2021
Dinamik Memory Tahsisi
*/
#include <stdio.h>
#include <stdlib.h>
//#pragma pack(1)
/*
//HEAP
global variables
+
dynamic memory
//STACK
Runtime variable allocation
LIFO
//SHARED MEMORY
dynamic memory
*/
//FULLTEXT SEARCH
//20 byte
//Ahmetxxxxxxxxxxx
//Süleymanxxxxxxxx
char szBuffer[100];
int main()
{
char *p = malloc( 100 ); //100 bayt tahsis et
if( p != NULL ) {
memset( p , 0 , 100 ); //ilgili pointerin gösterdigi yerden itibaren 100 bayt 0 karakteri ile doldur
memset( p , 'A' , 20 );
char *t = malloc( 100 );
if( t != NULL ) {
memset( t , 0 , 100 );
//memcpy( t , p , 10 );
strcpy( t , p );
//strncpy( t , p , 10 );
printf( "p=%s\nt=%s\n" , p , t );
free(t);
}
free( p );
}
return 0;
}