Skip to content

Instantly share code, notes, and snippets.

@ncaq
Created January 18, 2013 14:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ncaq/4565001 to your computer and use it in GitHub Desktop.
Save ncaq/4565001 to your computer and use it in GitHub Desktop.
重要なのは一行目のみ. 昔暇な時に考えた. 後で検索したら苦しんで覚えるC言語とかに書いてあった. しかももっとよい方法だった.
#define swap(a,b) (a=a+b,b=a-b,a=a-b)
#include <stdio.h>
void printAB(int a,int b)
{
printf("a:%d,b:%d\n",a,b);
}
int main()
{
int a = 0;
int b = 1;
printAB(a,b);
swap(a,b);
printAB(a,b);
return 0;
}
@Tester1759
Copy link

Test

@ncaq
Copy link
Author

ncaq commented Jan 18, 2013

いや,まあうん,バンバン使おう的なことは言ったけど,だからといって人のgistをtestの場所にするのはやめ…
は!gistとtestってなんか似てるな!もしやここははじめからtestの場所だったのか…!?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment