Lelouch never got Charles's code.
That was an old fan theory, but it was debunked by the community years ago.
The anime itself made it impossible and even the show staff have officially confirmed that Lelouch was truly dead.
So he never got a code or immortality.
There are also no scenes which show Lelouch as the cart driver. that's merely a fake fan-made video on youtube, it was never real. people made that to fool fans and to push their debunked conspiracy theory of him having a code.
All the official information regarding Lelouch's death can be found on the Code Geass Community Information Database. It has all the official statements, including sources, links, pictures, etc. It also shows how the anime made the fan theory impossible.
Here are some examples of official statements.
From "Geass Memories":
- "Before I started writing the story of a person called Lelouch, I confirmed with Taniguchi-director something. That thing was that the end of Lelouch will be death."
- "At least he is aware of his sins and pays for them with his death."
- "This man called Lelouch will pay for his sins by his death. The story follows him till he finally make this decision."
From the official guide book:
- "For those two who bear the heavy sin known as killing their fathers, they share the belief that they can forgive each other by imposing the greatest punishments on themselves. Death for Lelouch who wishes for a tomorrow with his sister, life for Suzaku who wishes to atone for his sins through death."
From the remade epilogue from 2009 where they dropped the cart driver scene and replaced it with a brand new epilogue:
- "A young man dies. He had the power to change the world, to create a new order. The world feared him, hated him. But, I know he died with a smile on his face. Only those who have realised their dream will truly understand that feeling of utter contentment. So, this is not a tragedy. And whenever I feel sad or cry at night, I sing a song. A song of man's making. Zero Requiem!"
All sources and many more examples can be found in the above linked Database