More actions
imported>joojis No edit summary |
imported>joojis No edit summary |
||
| Line 38: | Line 38: | ||
} | } | ||
} | } | ||
int main() | |||
{ | |||
printstring("abcd"); | |||
return 0; | |||
} | } | ||
Revision as of 08:20, 22 May 2012
출석
*권우성
수업 내용
스왑
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;
}