Yes they are exactly the same.
The first code in words:
SomeClass pointer sc = new SomeClass();
return SomeClass pointer sc
The second code in words
SomeClass pointer sc = new SomeClass();
SomeClass pointer rSc = SomeClass pointer sc
return SomeClass pointer rSc
As you can read/ see for yourself there is no difference since the second statement in the second example is redundant anyways
solved C++ Returning pointer from function