Upload presentasi
Presentasi sedang didownload. Silahkan tunggu
Diterbitkan olehFelix Pomade Telah diubah "9 tahun yang lalu
2
deklarasi deklarasi type_data *NamaVar type_data *NamaVar Pengalokasian memori pointer Pengalokasian memori pointer 1. Var_pointer = alamat_var_statis 1. Var_pointer = alamat_var_statis p = &a; p = &a; 2. Var_dinamis = new type_data 2. Var_dinamis = new type_data p = new int p = new int Pembebasan alamat Pembebasan alamat delete var_pointer delete var_pointer NULL = nilai pointer yang tidak menunjuk kemana-mana NULL = nilai pointer yang tidak menunjuk kemana-mana
3
void mani() { void mani() { int x = 5; int x = 5; int *p; int *p; *p = &x; *p = &x; printf(“\n Nilai X=%d”, x); printf(“\n Nilai X=%d”, x); printf(“\n Alamat X=%x”, &x); printf(“\n Alamat X=%x”, &x); printf(“\n Nilai p=%d”,*p); printf(“\n Nilai p=%d”,*p); printf(“\n Alamat p=%x”, &x); printf(“\n Alamat p=%x”, &x); } }
4
void main() { void main() { int *p, *q; int *p, *q; p = new int ; p = new int ; *p = 5; *p = 5; q = new int ; q = new int ; *q = 8; *q = 8; delete p; delete p; p = q; p = q; q = new int; q = new int; *q = 6; *q = 6; printf(“*p = %d q = %d”,p,q); printf(“*p = %d q = %d”,p,q); } }
5
void main() { void main() { int x = 7; int x = 7; int *p; int *p; p = &x; p = &x; printf(“ x = %d p = %d”,x,*p); printf(“ x = %d p = %d”,x,*p); *p = 70; *p = 70; printf(“ x = %d p = %d”,x,*p); printf(“ x = %d p = %d”,x,*p); } }
6
void main() { void main() { char *ps; char *ps; ps = “Bahasa C/C++”; ps = “Bahasa C/C++”; printf(%s\n”,ps); printf(%s\n”,ps); printf(ps); printf(ps); printf(“%c”,*ps); printf(“%c”,*ps); } }
Presentasi serupa
© 2024 SlidePlayer.info Inc.
All rights reserved.