I personally think it happened this way:
C.C. gave Lelouch her code during the two month time skip.
Counter arguments -
a) Why was C.C. crying at the church then?
b) Would C.C. really want to pass her curse of immortality to Lelouch?
c) If this happened, C.C. would die eventually and leave Lelouch alone.
My answer -
The first counter argument is answered by the second. C.C. clearly stated as she was crying: "As the price for using geass on other people, you ..." This blank can mean a million things, like "chose to be immortal", "chose to leave almost all the people you care about", "get hugged by the traitor Suzaku", and yes, "chose to die". I am leaning more towards the less blatant versions because it would be meaningless to omit the words otherwise. Simply put, she was probably crying because she made Lelouch immortal, and because she knew he had to leave everything behind.
Still, even if Lelouch became immortal, he can just find some person and give him/her a geass then manipulate them into using it a lot (much like C.C. did). He can then give his code to that person, that is, if he really wanted to lose his immortality.
On the third point, are you guys saying it is less lonely for Lelouch to simply die and leave C.C. alone, than them living together for one lifetime until C.C. perishes? Or maybe even perish together if they wish to (not that I think they would want geass to continue, but C.C.'s final line implies it is not impossible)? I agree with the loved and lost preference, but this sounds more akin to that idea than C.C. just enjoying memories of the past after she allowed her source of happiness to die a horrible death.
There are just too many assumptions in the Charles theory, unlike the C.C. one. <Occam's Razor>
Charles theory assumptions:
1) The code can be transferred without prolonged physical contact.
2) The code can be transferred inadvertently, or without consent or intent from both parties/the receiver.
3) What Kraco said, about the geass being a parasite.
4) The code remains dormant after transfer until the one that receives it dies.
The problem here is, none of these three points were ever proven in the show. Not only that, it is quite unlikely, since all the scenes that were shown to reveal the specifics of the code seem to go against it.
The only time the code was actually transferred (Charles and V.V.) clearly showed intent from the person that wishes to obtain it. The only time we actually saw the code being transferred (C.C. and Charles, albeit unsuccessful since C.C. broke physical contact) suggested that it was a process that took a relatively long time, not just a few seconds of accidental touching. Also, there was never any indication that the code is similar to a parasite or anything of the sort, or that it lies dormant after it gets transferred. While this does not make it impossible for the Charles theory to work, it makes it quite improbable.
EDIT: By the way, has it ever occurred to anyone that if assumption number 1 and 2 are true, all the times that C.C. and Lelouch touched (and there are several) should have led to a code transfer? This clearly did not happen though, which leads me to confirm that the Charles theory is quite bogus.
C.C. theory assumptions:
1) The code bearer (the immortal one), survives even after the code is transferred.
2) C.C. would actually give Lelouch her code.
3) Lelouch would actually want her code.
The first assumption has been strongly indicated, if not proven, when C.C. had her final chat with V.V. before he died. The second one has been addressed above and in the final paragraph of this post. The third one has been more than sufficiently addressed by Kraco in his posts.
Is there even a decent comparison between the two theories? The Charles theory assumes details and dynamics that were never revealed or even implied. The C.C. theory only assumes how the characters act and decide, which is much more open to interpretation, and has stronger arguments supporting it, compared to some random theory that relies on possibility instead of likelihood.
Regarding the danger of Lelouch reappearing again and destroying the peace... Simply laying low (like driving a wagon in some province in disguise) should aid greatly in avoiding detection. Heck, almost no one recognized him as Lelouch in that final scene (assuming it is him, which is what we are doing).
Plastic surgery is also an option, among a million other ways to hide your identity in a show that managed to get a maid disguised as Lelouch to kiss a girl and not get found out. It is a show about hiding one's identity and people are worried the most deceptive and smartest one around will stupidly get caught?
On a final note, C.C.'s reason for wanting death is loneliness. She wanted to be loved, not to simply experience it, but to have it. I doubt she would let Lelouch die if she could help it (in fact, keeping Lelouch alive was most of her mission, one that eventually superseded her wish for death), and she could, by simply transferring her code to him. Yes, she curses him with immortality, but I can easily see C.C. prioritizing her happiness (which is deeply rooted in caring for Lelouch and his survival), as she clearly showed when she asked Lelouch to simply cease his plans and told him that he has done enough. Also, it is not like the curse is permanent, since the code can be transferred. Before anyone replies by saying "I don't think they can do such a thing due to (moral reason A) and (moral reason B).", I would like to remind you that those two are hardly hindered by such things, if at all.