U E D R , A S I H C RSS

새싹교실/2012/열반/120521 (rev. 1.8)

새싹교실/2012/열반/120521


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++;
	}
}
void main(){
	prints("abcd");
}

Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:29:47
Processing time 0.0181 sec