Q:

Difference between call by pointer and returning pointer

Is there any difference calling by pointer or returning pointer in following code?
I just try to modify my struct and get the resutl.Lest say I have a struct.
struct Address
{
  const char* name; // "Jim Dandy"
  int number; // 61
};

Address* Modifying2(Address* adr)
{
  adr->name="Long John2";
  return adr;
}
//or
void Modifying3(Address* adr)
{
  adr->name="Long2 John2";
 // return adr; no return
}
void print_addr2(const Address& r)
{
  cout << r.name << '\n'
  << r.number << ' ' << r.street << '\n';  
}
int main()
{
   Address jd =
    {
    "Jim Dandy",
    61
    };

   Address* jdPtr=&jd;
   Modifying3(jdPtr);
   print_addr(jdPtr);
   //or
   print_addr(Modifying2(jdPtr));

  return 0;
}

Result is same but Which one is more safe? I mean well defined?

A:

Both methods are doing the same thing. Returning the pointer is not essential. 
But the most safest way is to pass the value by reference. (You haven't implement this way). Here how you must do it
void Modifying4(Address &adr)
{
  adr.name="Long2 John2";
}

