int var;
inputTree->SetBranchAddress("x", &var);
outputTree->Branch("x", &var);
inputTree->GetEntry(n);
outputTree->Fill();
(this is basically pseudo-code and I haven’t tested it). I know var is still there but it’s shared among the two trees.
But what is your goal here? That extra variable is definitely not hurting your performance or memory usage, and it’s very possible that the compiler optimize it away anyway.