Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

고한종/swap()

From ZeroWiki
Revision as of 08:49, 16 May 2011 by imported>rino0601@naver.com
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
#include <stdio.h>

void swap(int *a, int *b)
{
	int temp;
	temp = *a;
	*a = *b;
	*b = temp;
}

int main()
{
	int a=3 , b=5;
	printf("%d,%d\n",a,b);
	printf("%d,%d\n",&a,&b);
	swap(&a,&b);
	printf("%d,%d\n",a,b);
	printf("%d,%d\n",&a,&b);

	return 0;
}

댓글