LoginSignup
9
8

More than 5 years have passed since last update.

Cの共用体で愛が生まれた

Posted at

#include <stdio.h>
#include <string.h>

int main(void) {

  union {
    long l;
    char s[sizeof(long)];
  } t1, t2, t3;
  strcpy(t1.s, "死");
  strcpy(t2.s, "生");
  t3.l = t1.l & t2.l;
  printf("%s + %s = %s\n", t1.s, t2.s, t3.s);

  return 0;
}
output
死 + 生 =

愛が生まれた
なんで愛が生まれるのか

9
8
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
8