Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Revisions

2 of 3
some safer variants added.
LambdaBeta
  • 2.8k
  • 13
  • 20

C (gcc), 44 bytes

x(o,r)char*o,*r;{*o|*r?*o^=*r,x(o+1,r+1):0;}

Try it online!

Uses recursion, note that to print strings containing the null byte one will have to manage the strings as arrays. (See the footer of the link for an example)

C (gcc), 50 bytes

x(o,r)char*o,*r;{*o|*r?*o^=*r,x(o+!!*o,r+!!*r):0;}

Try it online!

Slightly safer version (doesn't read past end of strings, requires enough memory to exist past them though - a la strcpy).

C (gcc), 61 bytes

x(b,o,r)char*b,*o,*r;{*o|*r?*b=*r^*o,x(b+1,o+!!*o,r+!!*r):0;}

Try it online!

As safe as any standard C function taking a buffer, at the cost of a few more bytes.

LambdaBeta
  • 2.8k
  • 13
  • 20

AltStyle によって変換されたページ (->オリジナル) /