basic question about adresses and values in structs
    nikki via Digitalmars-d-learn 
    digitalmars-d-learn at puremagic.com
       
    Mon Sep  1 11:08:46 PDT 2014
    
    
  
so I am still very new to structs and & and * adress and pointer 
stuff, I have this basic code :
     struct S {
         int value = 0;
     }
     void func(S thing){
         writeln(&thing); //BFC52B44
         thing.value = 100;
     }
     S guy = {value:200};
     writeln(&guy); //BFC52CCC
     func(guy);
     writeln(guy.value);// this prints 200, because the adress was 
not the same
I think I see whats going on but I don't know how to fix it?
    
    
More information about the Digitalmars-d-learn
mailing list