POINTER 6 3 7 3 NESTED LOOP POINTER
- Slides: 118
POINTER 6. 3 & 7. 3 NESTED LOOP
POINTER ( PENUNJUK )
409
C C++ Borland Turbo C++ 4. 5 Dev-C++ 4. 9 5. 3 5. 11
Contoh Tipe Data : int atau signed int Turbo C++ 2 Byte Dev-C++ 4 Byte
Jumlah Byte pada Tipe Data Turbo C++ Dev-C++ char 1 1 short -- 2 int 2 4 long int 4 4 float 4 4 double 8 8 long double 10 12 bool -- 1
scanf() cin dan printf() cout
cin dan cout std: : cin dan std: : cout using namespace std;
scanf() cin dan printf() cout #include <conio. h> getch(); std: : cin dan std: : cout using namespace std;
scanf() cin dan printf() cout #include <conio. h> getch(); std: : cin dan std: : cout using namespace std;
Turbo C++ #include <stdio. h> void main() { int A; A = 65; printf( “%i”, A ); } Tercetak : 65 Dev-C++ 4. 9. 9. 2 #include <stdio. h> #include <conio. h> int main() { int A; A = 65; printf( “%i”, A ); getch(); } Tercetak : #include <iostream. h> void main() { int A; A = 65; cout << A; } Tercetak : 65 65 #include <stdio. h> #include <conio. h> int main() { int A; A = 65; printf( “%i”, A ); getch(); atau return (0); return 0; } Tercetak : 65
Dev-C++ 4. 9. 9. 2 #include <stdio. h> #include <conio. h> int main() { int A; A = 65; printf( “%i”, A ); getch(); } Tercetak : 65 #include <stdio. h> #include <conio. h> int main() { int A; A = 65; printf( “%i”, A ); getch(); atau return (0); return 0; } Tercetak : 65 Dev-C++ 4. 9. 9. 2 #include <iostream. h> #include <conio. h> int main() { int A; A = 65; cout << A; getch(); } Tercetak : 65 #include <iostream. h> #include <conio. h> int main() { int A; A = 65; cout << A; getch(); atau return (0); return 0; } Tercetak : 65
Dev-C++ 4. 9. 9. 2 #include <iostream. h> #include <conio. h> int main() { int A; A = 65; cout << A; getch(); } Tercetak : 65 #include <iostream. h> #include <conio. h> int main() { int A; A = 65; cout << A; getch(); return (0); } Tercetak : 65 Dev-C++ 4. 9. 9. 2 #include <iostream. h> #include <conio. h> int main() { int A; A = 65; printf(“%in”, A ); cout << A; getch(); } Tercetak : 65 65 Tidak perlu : #include<stdio. h> untuk Menggunakan : printf()
Dev-C++ 4. 9. 9. 2 #include <iostream. h> #include <conio. h> int main() { int A; Dev-C++ 5. 11 Dev-C++ 5. 3. 03 #include <iostream> #include <stdio. h> #include <conio. h> int main() A = 65; printf("%in", A ); { int A; A = 65; cout << A; printf("%in", A ); getch(); std: : cout << A; } Tercetak : 65 65 getch(); } Tercetak : 65 65
Dev-C++ 5. 11 Dev-C++ 5. 3. 03 #include <iostream> #include<stdio. h> #include <conio. h> int main() { int A; A = 65; printf(“%in”, A ); std: : cout << A; getch(); } Tercetak : 65 65 Dev-C++ 5. 11 Dev-C++ 5. 3. 03 #include <iostream> #include<stdio. h> #include <conio. h> using namespace std; int main() { int A; A = 65; printf(“%in”, A ); cout << A; getch(); } Tercetak : 65 65
Dev-C++ 5. 11 Dev-C++ 5. 3. 03 #include <iostream> #include<stdio. h> #include <conio. h> using namespace std; int main() { int A; A = 65; printf(“%in”, A ); cout << A; getch(); } Tercetak : 65 65 #include <iostream> #include<stdio. h> #include <conio. h> int main() { using namespace std; int A; A = 65; printf(“%in”, A ); cout << A; getch(); } Tercetak : 65 65
409
Berkaitan dengan alamat suatu lokasi memory Pengalokasian suatu area dalam memory (memory allocation) terkait dengan tipe data 409
Contoh Tipe Data : int atau signed int Turbo C++ 2 Byte Dev-C++ 4 Byte
Jumlah Byte pada Tipe Data Turbo C++ Dev-C++ char 1 1 short -- 2 int 2 4 long int 4 4 float 4 4 double 8 8 long double 10 12 bool -- 1
Alamat suatu lokasi dalam memory Alamat adalah nomor Byte
Dev-C++ 5. 11 Dev-C++ 5. 3. 03 #include <iostream> #include<stdio. h> #include <conio. h> using namespace std; int main() { int A; A = 17; cout << A; cout << "n " << &A ; printf("n %x ", &A ); printf("n %p ", &A ); getch(); return 0; } Tercetak : 17 0 x 22 ff 44 0022 FF 44
&A = alamat variabel A
Pointer, Assignment statement dan Output Statement
Contoh-01 Dev-C++ 5. 11 Dev-C++ 5. 3. 03 #include <iostream> #include<stdio. h> #include <conio. h> using namespace std; int main() { int X; X = 65; cout << X; getch(); } Tercetak : 65 Menggunakan Pointer #include <iostream> #include<stdio. h> #include <conio. h> using namespace std; int main() { int X, *P; X = 65; P = &X; cout << *P; getch(); } Tercetak : 65 Pointer P
#include <iostream> #include<stdio. h> #include <conio. h> using namespace std; int main() { int X, *P; X = 65; P = &X; cout << *P; getch(); } Tercetak : 65
#include <iostream> #include<stdio. h> #include <conio. h> using namespace std; int main() { int X, *P; X = 65; P = &X; cout << *P; getch(); } Tercetak : X P int X, *P; int* Menyiapkan variabel X dan P. X bertipe int P bertipe int* 65 Untuk selanjutnya disebut : bertipe pointer yang dapat diisi dengan alamat suatu area, area apa saja yang bertipe int, baik area yang punya nama maupun yang tidak punya nama Pointer P
int X, *P ; nama pointer bebas
*P P atau int* int X, *P; atau int X; int* P;
#include <iostream> #include<stdio. h> #include <conio. h> using namespace std; int main() { int X, *P; X = 65; P = &X; cout << *P; getch(); } Tercetak : 65 X X = 65; P 65 int*
X #include <iostream> #include<stdio. h> #include <conio. h> using namespace std; int main() { int X, *P; X = 65; P = &X; cout << *P; getch(); } Tercetak : 65 atau : 65 P = &X; Mengisi Pointer P dengan alamat variabel X *P 22 FF 44 Misal alamat variabel X = 22 FF 44 2293572 Bila dinyatakan dalam bilangan Decimal Biasanya alamat dinyatakan dalam bilangan Hexadecimal
1048576 2 65536 2 4096 15 256 15 16 4 1 4 2097152 + 131072 + 61440 + 3840 + 64 + 4 = 2293572
#include <iostream> #include<stdio. h> #include <conio. h> using namespace std; int main() { int X, *P; X = 65; P = &X; cout << *P; getch(); } Tercetak : 65 P = &X; *P X cout << *P; Mencetak isi area (variabel) yang alamatnya ada dalam Pointer P 65 22 FF 44 Yang alamatnya ada dalam Pointer P adalah variabel X Mencetak isi variabel x
#include <iostream> #include<stdio. h> #include <conio. h> using namespace std; int main() { int X, *P; X = 65; P = &X; cout << *P; getch(); } Tercetak : P menyimpan alamat X P = &X; Untuk selanjutnya diilustrasikan dengan gambar : P X 65 Baca: P menunjuk X
P X P = &X; P menunjuk X
Contoh-02 #include <iostream> #include<stdio. h> #include <conio. h> using namespace std; int main() { int X, *P; P = &X; *P = 65; cout << X; getch(); } Tercetak : 65 *P = 65; P X Mengisi variabel yang alamatnya ada dalam Pointer P *P = 65; Assinment Statement 65
Contoh-03 #include <iostream> #include<stdio. h> #include <conio. h> using namespace std; int main() { int X, *P; P = &X; *P = 65; cout << *P; getch(); } Tercetak : 65 *P = 65; P X Mengisi variabel yang alamatnya ada dalam Pointer P 65
Contoh-04 #include <iostream> #include<stdio. h> #include <conio. h> using namespace std; int main() { int X, *P; P = &X; *P = ‘A’ ; cout << X ; getch(); } Tercetak : 65 *P = ‘A’; P X Karakter ‘A’ nilai ASCIInya = 65 65
Pointer, Assignment statement dan Intput Statement
TCWIN 45 Contoh-05 a Misal diinput nilai : 17 #include<iostream. h> int main() { int X; cin >> X ; cout << X; } 17 17 #include<iostream. h> int main() { int X, *P; P=&X; cin >> *P; cout << *P; } 17 17 #include<stdio. h> int main() { int X, *P; P=&X; scanf("%i", P ); printf("%in", X ); printf("%in", *P ); } 17 17 17
Dev-C++ 4. 9. 9. 2 Contoh-05 b Misal diinput nilai : 17 #include<iostream. h> #include<conio. h> int main() #include<iostream. h> { int X; #include<conio. h> cin >> X; int main() cout << X; { int X, *P; getch(); P = &X; cin >> *P; return 0; cout << *P; } cout << "n" << X; 17 getch(); 17 return 0; } 17 17 17 #include<iostream. h> #include<conio. h> int main() { int X, *P; P = &X; scanf("%i", P ); cout << *P; cout << "n" << X; getch(); return 0; } 17 17 17
Contoh-05 c Menggunakan Dev-C++ 5. 11 Dev-C++ 5. 3. 03 Misal diinput nilai : 17 #include <iostream> #include<stdio. h> #include <conio. h> using namespace std; int main() { int X; cin >> X ; cout << X; } Terlihat di layar monitor : 17 17 Pointer #include <iostream> #include<stdio. h> #include <conio. h> using namespace std; int main() { int X, *P; P = &X; cin >> *P ; cout << X ; getch(); } Terlihat di layar monitor : 17 17
Pointer menunjuk elemen array ‘Menggeser’ Pointer ‘maju’ atau ‘mundur’
Contoh-06 a Dev-C++ 4. 9. 9. 2 #include<iostream. h> #include<conio. h> int main() { int A[6]={5, 10, 15, 20, 25, 30}; int i, *P; P = &A[0]; cout << *P << " " ; P++; cout << *P ; getch(); return 0; } Tercetak : 5 10 0 1 2 3 4 5 A 5 10 15 20 25 30 P P = &A[0]; 0 1 2 3 4 5 A 5 10 15 20 25 30 P P++; atau P=P+1; Menggeser Pointer P ‘maju’ satu langkah
Contoh-06 b Dev-C++ 4. 9. 9. 2 #include<iostream. h> #include<conio. h> int main() { int A[6]={5, 10, 15, 20, 25, 30}; int i, *P; P = &A[0]; printf(“%i ”, *P ) ; P++; cout << *P ; getch(); return 0; } Tercetak : 5 10 Mencetak menggunakan printf() 0 1 2 3 4 5 A 5 10 15 20 25 30 P P = &A[0]; 0 1 2 3 4 5 A 5 10 15 20 25 30 P P++; atau P=P+1; Menggeser Pointer P ‘maju’ satu langkah
Contoh-07 #include<iostream. h> #include<conio. h> int main() { int A[6]={5, 10, 15, 20, 25, 30}; int i, *P; P = A; cout << *P << " " ; P++; cout << *P ; getch(); return 0; } Tercetak : 0 Dev-C++ 4. 9. 9. 2 1 2 3 4 A 5 10 15 20 25 30 P P = A; Menempatkan Pointer P pada alamat array A yaitu alamat elemen pertama array A. sama maksudya dengan : 5 10 P = &A[0]; Tanpa 5 ‘&’
0 1 2 3 4 5 A 5 10 15 20 25 30 P P = A; atau P = &A[0];
Contoh-08 0 #include<iostream. h> #include<conio. h> int main() { int A[6]={5, 10, 15, 20, 25, 30}; int i, *P; P = &A[3]; cout << *P << " " ; P++; cout << *P ; getch(); return 0; } Tercetak : 20 25 P++; 1 2 3 4 5 A 5 10 15 20 25 30 P P = &A[3]; 0 1 2 3 4 5 A 5 10 15 20 25 30 P P++; atau P=P+1; Menggeser Pointer P ‘maju’ satu langkah
Contoh-09 0 #include<iostream. h> #include<conio. h> int main() { int A[6]={5, 10, 15, 20, 25, 30}; int i, *P; P = &A[3]; cout << *P << " " ; P--; cout << *P ; getch(); return 0; } Tercetak : 20 15 P- -; 1 2 3 4 5 A 5 10 15 20 25 30 P P = &A[3]; 0 1 2 3 4 5 A 5 10 15 20 25 30 P P - -; atau P=P-1; Menggeser Pointer P ‘mundur’ satu langkah
P++ : maju satu langkah P-- : mudur satu langkah Satu langkah berapa Byte ? Tergantung pengalokasian memory ( memory allocation) untuk Dev-C++ : char short int long int float double : : : 1 Byte 2 4 4 4 8
Contoh-10 #include<iostream. h> #include<conio. h> int main() { int A[6]={5, 10, 15, 20, 25, 30}; int *P; P = &A[3]; cout << *P++ << " " ; cout << *P ; getch(); return 0; } Tercetak : 20 25 0 1 2 3 4 5 A 5 10 15 20 25 30 P = &A[3]; P cout << *P++ ; Mencetak isi elemen yang ditunjuk oleh P , kemudiap P maju satu langkah. 0 1 2 3 4 5 A 5 10 15 20 25 30 P
Contoh-11 #include<iostream. h> #include<conio. h> int main() { int A[6]={5, 10, 15, 20, 25, 30}; int *P; P = &A[3]; cout << *P- - << " " ; cout << *P ; getch(); return 0; } Tercetak : 20 15 0 1 2 3 4 5 A 5 10 15 20 25 30 P = &A[3]; P cout << *P- - ; Mencetak isi elemen yang ditunjuk oleh P , kemudiap P mundur satu langkah. 0 1 2 3 4 5 A 5 10 15 20 25 30 P
Contoh-12 #include<iostream. h> #include<conio. h> int main() { int A[6]={5, 10, 15, 20, 25, 30}; int *P; P = &A[3]; cout << *++P << " " ; cout << *P ; getch(); return 0; } Tercetak : 25 25 0 1 2 3 4 5 A 5 10 15 20 25 30 P = &A[3]; P cout << *++P ; P maju dulu satu langkah kemudian mencetak isi elemen yang ditunjuk oleh P. 0 1 2 3 4 5 A 5 10 15 20 25 30 P
Contoh-13 #include<iostream. h> #include<conio. h> int main() { int A[6]={5, 10, 15, 20, 25, 30}; int *P; P = &A[3]; cout << *- -P << " " ; cout << *P ; getch(); return 0; } Tercetak : 15 15 0 1 2 3 4 5 A 5 10 15 20 25 30 P = &A[3]; P cout << *- -P ; P mundur dulu satu langkah kemudian mencetak isi elemen yang ditunjuk oleh P. 0 1 2 3 4 5 A 5 10 15 20 25 30 P
Contoh-14 #include<iostream. h> #include<conio. h> int main() { int A[6]={5, 10, 15, 20, 25, 30}; int *P; P = &A[3]; cout << ++*P << " " ; cout << *P ; getch(); return 0; } Tercetak : 21 21 0 1 2 3 4 5 A 5 10 15 20 25 30 P = &A[3]; P cout << ++*P ; Isi elemen yang ditunjuk oleh P ditambah 1 dulu , kemudian mencetak isi elemen yang ditunjuk oleh P. P-nya sendiri tidak bergerak 0 1 2 3 4 5 A 5 10 15 21 25 30 P
Contoh-15 #include<iostream. h> #include<conio. h> int main() { int A[6]={5, 10, 15, 20, 25, 30}; int *P; P = &A[3]; cout << --*P << " " ; cout << *P ; getch(); return 0; } Tercetak : 19 19 0 1 2 3 4 5 A 5 10 15 20 25 30 P = &A[3]; P cout << - -*P ; Isi elemen yang ditunjuk oleh P dikurangi 1 dulu , kemudian mencetak isi elemen yang ditunjuk oleh P. P-nya sendiri tidak bergerak 0 1 2 3 4 5 A 5 10 15 19 25 30 P
Contoh-16 a 1 #include<iostream. h> #include<conio. h> int main() { int A[6]={5, 10, 15, 20, 25, 30}; int i, *P; P = &A[0]; for( i=1 ; i<=6 ; i++ ) { cout << *P << " "; P++; } getch(); return 0; } Tercetak : 5 10 15 20 25 30 Yang penting loop dikerjakan 6 kali 0 1 2 3 4 5 A 5 10 15 20 25 30 P = &A[0]; P 0 1 2 3 4 5 A 5 10 15 20 25 30 P selalu ditambah 1 Terakhir P menunjuk satu lokasi diluar array P
for( i=1 ; i<=6 ; i++ ) { cout << *P << " “ ; P++; } Loop hanya mengatur berapa kali proses dilakukan Isi lokasi yang dicetak, tergantung yang ditunjuk oleh Pointer
Contoh-16 a 2 #include<iostream. h> #include<conio. h> int main() { int A[6]={5, 10, 15, 20, 25, 30}; int i, *P; P = &A[0]; for( i=1 ; i<=6 ; i++ ) { cout << *P << " " ; P++; } cout << *P ; getch(); return 0; } Tercetak : 5 10 15 20 25 30 xx 0 1 2 3 4 5 A 5 10 15 20 25 30 P = &A[0]; P 0 1 2 3 4 5 A 5 10 15 20 25 30 P Mencetak isi lokasi diluar array yang nilainya tidak kita ketahui
Contoh-16 b #include<iostream. h> #include<conio. h> int main() { int A[6]={5, 10, 15, 20, 25, 30}; int i, *P; P = &A[0]; for( i=2 ; i<=7 ; i++ ) { cout << *P << " " ; P++; } getch(); return 0; } Tercetak : 5 10 15 20 25 30 Yang penting loop dikerjakan 6 kali 0 1 2 3 4 5 A 5 10 15 20 25 30 P = &A[0]; P 0 1 2 3 4 5 A 5 10 15 20 25 30 P selalu ditambah 1 Terakhir P menunjuk satu lokasi diluar array P
Contoh-16 c 0 #include<iostream. h> #include<conio. h> int main() { int A[6]={5, 10, 15, 20, 25, 30}; int i, *P; P = &A[0]; for( i=6 ; i>=1 ; i- - ) { cout << *P << " " ; P++; } getch(); return 0; } Tercetak : 5 10 15 20 25 30 Yang penting loop dikerjakan 6 kali 1 2 3 4 5 A 5 10 15 20 25 30 P = &A[0]; P 0 1 2 3 4 5 A 5 10 15 20 25 30 P selalu ditambah 1 Terakhir P menunjuk satu lokasi diluar array P
Contoh-17 0 #include<iostream. h> #include<conio. h> int main() { int A[6]={5, 10, 15, 20, 25, 30}; int i, *P; P = A; for(i=1; i<=6; i++ ) { cout << *P << " "; P++; } getch(); return 0; } Tercetak : 1 2 3 4 A 5 10 15 20 25 30 P P = A; Menempatkan Pointer P pada alamat array A yaitu alamat elemen pertama array A. sama maksudya dengan : 5 10 15 20 25 30 P = &A[0]; Tanpa 5 ‘&’
Contoh-18 #include<iostream. h> #include<conio. h> int main() { int A[6]={5, 10, 15, 20, 25, 30}; int i, *P; P = &A[5]; for(i=1; i<=6; i++ ) { cout << *P << " "; P--; } getch(); return 0; } Tercetak : 30 25 20 15 10 5 0 1 2 3 4 5 A 5 10 15 20 25 30 P P = &A[5]; 0 1 2 3 4 5 A 5 10 15 20 25 30 P P--; atau P=P-1; Menggeser Pointer P ‘mundur’ satu langkah
Contoh-19 #include<iostream. h> #include<conio. h> int main() { int A[6]={5, 10, 15, 20, 25, 30}; int i, *P; P = &A[0]; for(i=1; i<=6; i++ ) { cout << *P++ << " "; } getch(); return 0; } Tercetak : 5 10 15 20 25 30 0 1 2 3 4 5 A 5 10 15 20 25 30 P = &A[0]; P cout << *P++; Setelah mencetak isi elemen yang ditunjuk oleh P, P maju satu langkah 0 1 2 3 4 5 A 5 10 15 20 25 30 Kondisi terakhir P
Contoh-20 #include<iostream. h> #include<conio. h> int main() { int A[6]={5, 10, 15, 20, 25, 30}; int i, *P; P = &A[0]; for(i=1; i<=6; i++ ) { cout << ++*P << " "; } cout << "n"; for(i=0; i<=5; i++ ) { cout << A[i] << " "; } getch(); return 0; } Tercetak : 6 7 8 9 10 11 11 10 15 20 25 30 0 1 2 3 4 5 A 5 10 15 20 25 30 P cout << ++*P; ISI elemen yang ditunjuk oleh P, selalu ditambah 1 (satu) sebelum dicetak. Sedangkan Pnya sendiri tidak bergeser maju, sehingga isi elemen a[0] , mula-mula menjadi 6, kemudian menjadi 7, 8, 9, 10 dan 11.
Contoh-21 #include<iostream. h> #include<conio. h> int main() { int A[6]={5, 10, 15, 20, 25, 30}; int i, *P; P = &A[0]; for(i=1; i<=5; i++ ) { cout << *++P << " "; } getch(); return 0; } Tercetak : 10 15 20 25 30 Hanya 5 kali mencetak 0 1 2 3 4 5 A 5 10 15 20 25 30 P = &A[0]; P cout << *++P; Pointer P maju lebih dulu satu langkah (menunjuk elemen berikutnya) kemudin mencetak isi elemen yang ditunjuknya. 0 1 2 3 4 5 A 5 10 15 20 25 30 P
Contoh-22 #include<iostream. h> #include<conio. h> int main() { int A[6]={0}; int i, *P; P = &A[3]; cin >> *P ; for( i=0 ; i<=5 ; i++ ) } { cout << A[i] << } getch(); return 0; Telihat di layar : ""; 17 0 0 0 17 0 0 Misal diinput nilai : 17 0 A 0 1 2 3 0 0 0 P = &A[3]; 0 A 0 4 5 0 0 4 5 P 1 2 3 0 0 17 P 0 0
Contoh-23 #include<iostream. h> #include<conio. h> int main() { int A[6]={0}; int i, *P; P = &A[3]; cin >> *++P ; for( i=0 ; i<=5 ; i++ ) } { cout << A[i] << } getch(); return 0; Telihat di layar : ""; 17 0 0 17 0 Misal diinput nilai : 17 0 A 0 1 2 3 0 0 0 P = &A[3]; 0 A 0 4 5 0 0 P 1 2 3 4 5 0 0 0 17 0 P
Contoh-24 #include<iostream. h> #include<conio. h> int main() { int A[6]={0}; int i, *P; P = &A[3]; cin >> *- -P ; for( i=0 ; i<=5 ; i++ ) } { cout << A[i] << } getch(); return 0; Telihat di layar : ""; 17 0 0 0 Misal diinput nilai : 17 0 A 0 1 2 3 0 0 0 P = &A[3]; 0 A 0 4 5 0 0 4 5 P 1 2 3 0 17 0 P 0 0
Contoh-25 #include<iostream. h> #include<conio. h> int main() { int A[6]={0}; int i, *P; P = &A[3]; cin >> *P++ ; for( i=0 ; i<=5 ; i++ ) } { cout << A[i] << } getch(); return 0; Telihat di layar : ""; 17 0 0 0 17 0 0 Misal diinput nilai : 17 0 A 0 1 2 3 0 0 0 P = &A[3]; 0 A 0 4 5 0 0 4 5 P 1 2 3 0 0 17 0 P 0
Contoh-26 #include<iostream. h> #include<conio. h> int main() { int A[6]={0}; int i, *P; P = &A[3]; cin >> *P- - ; for( i=0 ; i<=5 ; i++ ) } { cout << A[i] << } getch(); return 0; Telihat di layar : ""; 17 0 0 0 17 0 0 Misal diinput nilai : 17 0 A 0 1 2 3 0 0 0 P = &A[3]; 0 A 0 4 5 0 0 4 5 P 1 2 3 0 0 17 P 0 0
0 #include<iostream. h> #include<conio. h> A 0 int main() { int A[5]={0}; int i, *P; P = &A[0]; for( i=1 ; i<=5 ; i++ ) { cin >> *P ; P++; Misal diinput : 7 4 10 15 12 } P 0 A 7 1 2 3 4 0 0 P = &A[0]; 1 2 3 4 4 10 15 12 for( i=0 ; i<=4 ; i++ ) { cout << A[i] << " " ; 7 } 4 getch(); return 0; } 10 15 12 7 4 10 15 12 P
#include<iostream. h> #include<conio. h> int main() { int A[5]={0}; int i, *P; P = &A[0]; for( i=1 ; i<=5 ; i++ ) { cin >> *P ; P++; } for( i=0 ; i<=4 ; i++ ) { cout << A[i] << " " ; } getch(); return 0; } cin >> *P ; P++; Dapat diganti menjadi : cin >> *P++ ;
TCWIN 45 #include<stdio. h> void main() { char X[7]="ABCDEFG"; char *P, *Q; P=&X[0]; Q=&X[6]; while( P != Q ) { printf("%c ", *P++ ) ; } } ABCDEF #include<stdio. h> void main() { char X[7]="ABCDEFG"; char *P, *Q; P=&X[0]; Q=&X[6]; while( P != Q ) { printf("%c ", *P++ ) ; } printf(“%c”, *P ) ; } ABCDEFG
Turbo C++ #include<stdio. h> void main() { char X[7] = "ABCDEFG“ ; char *P, *Q; P=&X[0]; Q=&X[6]; while( P <= Q ) { printf("%c ", *P++ ) ; } } ABCDEFG
#include <iostream> #include<stdio. h> #include <conio. h> using namespace std; int main() { int X, *P; X = 65; P = &X; cout << P; getch(); } Tercetak : 0 x 24 ff 0 #include <iostream> #include<stdio. h> #include <conio. h> using namespace std; int main() { int X, *P; X = 65; P = &X; printf(“%x”, P); getch(); } Tercetak : 24 fea 8
#include<stdio. h> #include<conio. h> int main() { char X[5]="ABCD"; char *P, *Q, *R, *S, *T; P=X; puts(X); //printf("sn", P); Q=&X[0]; R=&X[1]; S=&X[2]; T=&X[3]; printf("%c %c n", *Q, *R, *S, *T); printf("%X %X n", Q, R, S, T); getch(); }
#include<stdio. h> void main() { char X[5]="ABCD"; printf("%s", X ); } TCWIN 45 ABCD #include<stdio. h> int main() { char X[5]="ABCD"; printf("%s", X ); } ABCD printf("%s", X ); return 0; TCWIN 45 } ABCD TCWIN 45
#include<iostream. h> void main() { char X[5]="ABCD"; cout << X; } ABCD TCWIN 45
#include<iostream. h> #include<conio. h> int main() { char X[5]="ABCD"; printf("%s", X ); getch(); return 0; } ABCD Dev-C++ 4. 9. 3 #include<iostream. h> #include<conio. h> int main() { char X[5]="ABCD"; cout << X ; getch(); return 0; } Dev-C++ 4. 9. 3 ABCD
#include<stdio. h> #include<conio. h> int main() { char X[5]="ABCD"; puts(X); getch(); return(0); } ABCD #include<stdio. h> #include<conio. h> int main() { char X[5]="ABCD"; char *P; P=X; puts(P); getch(); return(0); } ABCD
#include<iostream. h> #include<stdio. h> #include<conio. h> int main() { char X[5]="ABCD"; printf("%sn", X); cout << X; getch(); return 0; } TCWIN 45 ABCD
#include<iostream. h> #include<stdio. h> #include<conio. h> int main() { char X[5]="ABCDE"; printf("%sn", X); cout << X; getch(); return 0; } TCWIN 45 ABCDE………………. . Karakter sembarang
#include<iostream. h> #include<stdio. h> #include<conio. h> int main() { char X[5]="ABCD"; char *P; P=X; printf("%sn", P); cout << P; getch(); return 0; } TCWIN 45 ABCD
#include<iostream. h> //#include<stdio. h> #include<conio. h> int main() { char X[5]="ABCa"; printf("%sn", X); cout << X; getch(); return 0; }
#include<iostream. h> #include<conio. h> int main() { char X[5] = "PQRS" ; char *P; P=X; printf("%sn", P); cout << P; getch(); return 0; } Dev-C++ 4. 9. 3 PQRS
#include<iostream. h> #include<stdio. h> #include<conio. h> int main() { char *P; P = "Jakarta"; printf("%sn", *&*&P); getch(); return 0; } Jakarta TCWIN 45
//Turbo C++ #include<iostream. h> #include<stdio. h> #include<conio. h> int main() { char *P = "Jakarta"; printf("%sn", *&*&P); getch(); return 0; } Jakarta TCWIN 45
//Turbo C++ #include<iostream. h> #include<stdio. h> #include<conio. h> int main() { char *P = "Jakarta"; printf("%sn", P); getch(); return 0; } Jakarta TCWIN 45
//Dev-C++ 4. 9. 9. 2 #include<iostream. h> #include<conio. h> int main() { char *P = "Jakarta"; printf("%sn", *&*&P); printf("%sn", P); getch(); return 0; } } Jakarta
//Dev-C++ 4. 9. 9. 2 #include<stdio. h> #include<string. h> #include<conio. h> int main() { char A[2][3]; strcpy(A[0], "ABC"); strcpy(A[1], "DEF"); printf("%cn", A[1][2]); getch(); return 0; } F #include<stdio. h> #include<string. h> #include<conio. h> int main() { char A[2][3]; strcpy(A[0], "ABC"); strcpy(A[1], "DEF"); int i, j; for(i=0; i<=1; i++) {for(j=0; j<=2; j++) { printf("%c ", A[i][j]); } printf("n"); } getch(); return 0; } ABC DEF
//Dev-C++ 4. 9. 9. 2 #include<iostream. h> #include<string. h> #include<conio. h> int main() { char A[7]; { char A[2][7]; char *P = "Jakarta"; strcpy( A, P ); strcpy( A[0] , P ); printf("%sn", A[0]); getch(); return 0; } Jakarta
#include<iostream. h> #include<stdio. h> #include<conio. h> int main() { char *P; P = "Hello"; printf("%sn", *&*&P); getch(); #include<iostream. h> return 0; #include<stdio. h> } Hello TCWIN 45 #include<conio. h> int main() { char *P; P = "Hello"; printf("%sn", P ); getch(); return 0; } Hello TCWIN 45
- Constant pointer and pointer to constant
- Pointer pointer
- Pointer constant in c
- Pointer pointer
- Constant pointer and pointer to constant
- Constant pointer and pointer to constant
- What is pointer to pointer in c
- Pointer expressions and pointer arithmetic
- Block nested loop join
- Is nested loops bad
- Contoh pseudocode do while
- Nested loop in assembly language
- Matlab nested for loop
- Nested for loop complexity
- Nested for loop flowchart
- Looping pascal
- Pernyataan while digunakan untuk
- If then pseudocode
- Perulangan python
- Nested for loop
- What is nested loop
- Formula loop nested logic
- For loop in c example
- Flowchart nested loop
- If else in pseudocode
- Block nested loop join cost example
- Block nested loop join cost
- Contoh soal nested loop
- Nested for loop pseudocode
- Statement perulangan
- Multi loop pid controller regolatore pid multi loop
- Manakah yang lebih baik open loop atau close loop system
- Blok diagram pemanggang roti
- Do while loop
- Fifth gear loop the loop
- Ulnar loop on right hand
- Open loop vs closed loop in cars
- Let t(x y) means that student x likes cuisine y
- N nested for loops
- What is nested if else statement in c
- Nested third party sender
- Nested subprograms in ppl
- Nested quantifiers
- Selection control
- Quantifiers discrete mathematics exercises
- Nested case control study
- Case structure pseudocode
- Nested decision structure
- Flowchart nested if
- Nested linked list
- Dilts nested levels of learning
- Nested dirichlet process
- Lesson 13 bee nested loops
- Single row functions can be nested
- Contoh soal rancangan tersarang
- Nested decision structures in python
- Incorporating quotes
- What is nested if else statement in c
- Nested conditional statements definition
- Nested anova
- Hierarchical clustering
- Discrete math cartesian product
- C++ nested
- Rancangan petak tersarang
- Case control study
- Negating nested quantifiers
- Xml elements must be properly nested
- Nested linked list
- Example of nesting of member function in c++
- Overfitting loss curve
- Nested quantifiers
- Jenis jenis kontrol program
- Time and space complexity
- Nested quantifiers
- Closest nested scope rule
- Closest nested scope rule
- Nested loops python
- Nested squares recursive formula
- Verilog paramter
- A nested model for visualization design and validation
- Sql nested aggregate functions
- Mfoc-hardnested
- Flush shared pool
- Mips nested functions
- Closest nested scope rule
- Flat transaction in distributed system
- Nested state diagram in uml
- Nested loops java
- Nested quantifiers exercises
- Is array a structured data type
- Nested loops storytelling
- Ihwah
- Nested selection structure
- Struct in c
- Example of nested transaction in distributed system
- Three stage nested design
- Intel 80186
- Nested anova spss
- Argtab
- A pointer is
- Explicit pointers
- Skip pointer
- Pointer rapat
- Stack pointer nedir
- Pointer ucn
- Teknik pointer
- Pointer offset notation
- A^3-b^3
- User data type
- Stevie pointer
- A pointer is
- Pointer and one dimensional array
- Pointer subterfuge
- Significance of pointer
- Daniel pointer
- Mast cell tumor german shorthaired pointer
- Java pointers
- A pointer is
- Teknik pointer