title: how can i update value of a struct using a function in C++?
body: <p>i have defiened a structure here   </p>
  
  <pre><code>struct Owner{
  
  char* ownerName;char* fatherName;char* address;};
  
  
  void registerV(Owner *);
  
  main(){
  </code></pre>
  
  <p>here im initializing the owner      </p>
  
  <pre><code>struct Owner owner;
  
    owner.ownerName="Imran Ali";
    owner.fatherName="Ali Khokhar";
    owner.adress="KhushalPura";
    registerV(&amp;owner);
  
  }
  </code></pre>
  
  <p>In this function i am taking input from the user which i have to display in the main section using another function. But when i try to do so i get garbage values</p>
  
  <pre><code>void registerV(struct Owner *ownerPtr)
  {
  
   char buyersName[50];
   char fatherName[50];
   char adress[100];
  
   cin.getline(buyersName, 50);
   cout &lt;&lt; " Enter Buyers Name : " ;
   cin.getline(buyersName, 50);
   (*ownerPtr).ownerName=buyersName;
  
   cout &lt;&lt; " Enter Fathers Name : " ;
   cin.getline(fatherName, 50);
   (*ownerPtr).fatherName=fatherName;
  
   cout &lt;&lt; " Enter Adress : " ;
   cin.getline(adress, 100);
   (*ownerPtr).adress=adress;
  }
  </code></pre>
  
  <p>When i try to view the values from the main function i get garbage values. Please help me.</p>