digrev
07-13-2012, 06:46 PM
hi i am trying too learn pointer aritmathics but i dont understand one thing
let me explain
in this code i get the adress value or just the values that pointer contains
int dizi[3]={1,2,3};
int *ptr=dizi;
cout<<*ptr;(no problem with value)
cout<<ptr;(no problem with adress)
but i cant do the same thing with the char array
char dizi[10]="blabla";
char *p=dizi;
cout<<&p[0](cannot get adress );
or this
cout<<p](cannot get adress );
let me explain
in this code i get the adress value or just the values that pointer contains
int dizi[3]={1,2,3};
int *ptr=dizi;
cout<<*ptr;(no problem with value)
cout<<ptr;(no problem with adress)
but i cant do the same thing with the char array
char dizi[10]="blabla";
char *p=dizi;
cout<<&p[0](cannot get adress );
or this
cout<<p](cannot get adress );