pointers and adresses

Shouldn't this code print the same adress for p.fillim and h.begin?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
struct programet
  {
      int ID ;
      char * fillim;
      char * fund;
  } ;

  struct holes
  {
      char *begin;
      char *end;
  } ;

  programet p;
  holes h;
  p.fillim = &kujtesa[0];
  h.begin = &kujtesa[0];
  cout<<&p.fillim<<endl;
  cout<<&h.begin<<endl;
No, they are part of different structures. Maybe you meant to just print p.fillim and h.begin?
but if i give them the same address,which is kujtesa[0] , shouldn't they get the same value?
They are, but you aren't printing out their value. You are printing out their addresses.
so if i print cout<<p.fillim<<h.begin<<endl; i'll have the same output,right? thank u
Topic archived. No new replies allowed.