MEMBERI NILAI ARRAY DENGAN POINTER

#include "iostream.h"
#include "conio.h"
void main()
{ int x[5], *p, k;
clrscr();
p = x;
x[0] = 5;
x[1] = x[0];
x[2] = *p + 2;
x[3] = *(p+1) - 3;
x[4] = *(x + 2);
for(k=0; k<5; k++)
cout<<"x["<<k<<"] = "<< x[k]<<"\n";
getch();
}

No comments:

Post a Comment