U E D R , A S I H C RSS

새싹교실/2012/열반/120521

Difference between r1.1 and the current

@@ -1,17 +1,51 @@
[TableOfContents]
 
-출석-
==권우성==
==스왑==
[[TableOfContents]]
= 출석 = 
*권우성 
= 수업 내용 =
== 스왑 ==
{{{
void swap(int *a, int *b){
int temp;
temp=*a;
*a=*b;
*b=temp;
}
 
//분석해보세요
void swap(int *a, int *b){
if((*a)!=(*b)){
*a^=*b^=*a^=*b;
}
}
 
int main()
{
int x=5, y=10;
 
printf("%d %d\n", x, y);
 
swap(&x, &y);
 
printf("%d %d\n", x, y);
 
return 0;
}
}}}
==문자열 출력==
== 문자열 출력 ==
{{{
void printstring(char *ptr){
while(*ptr){
putc(*ptr, stdout);
ptr++;
}
}

int main()
{
printstring("abcd");
 
return 0;
}
}}}



1. 출석

  • 권우성

2. 수업 내용

2.1. 스왑

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

	temp=*a;
	*a=*b;
	*b=temp;
}

//분석해보세요
void swap(int *a, int *b){
	if((*a)!=(*b)){
		*a^=*b^=*a^=*b;
	}
}

int main()
{
	int x=5, y=10;

	printf("%d %d\n", x, y);

	swap(&x, &y);

	printf("%d %d\n", x, y);

	return 0;
}

2.2. 문자열 출력

void printstring(char *ptr){
	while(*ptr){
		putc(*ptr, stdout);
		ptr++;
	}
}

int main()
{
	printstring("abcd");

	return 0;
}
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:29:47
Processing time 0.0302 sec