Contoh Program C++ Pointer Dengan Array
Ini Contoh Programnya :
#include <iostream.h>
#include <conio.h>
int main ()
{
char array[5];
char * p;
p = array; *p = 'a';
p++; *p = 'b';
p = &array[2]; *p = 'c';
p = array + 3; *p = 'd';
p = array; *(p+4) = 'e';
for (int n=0; n<5; n++)
cout << array[n] << ", ";
getch();
}
Ini Contoh Outputnya :
Comments
Post a Comment