Hisworld.tistory.com
The hisWorld
(140)
hisworld_new
(0)
hisOld
(138)
Android
(7)
Computer Vision
(18)
JAVA
(4)
C/C++
(26)
열혈강의 C
(32)
TCP/IP socket
(12)
WinAPI
(16)
System Programming
(0)
etc
(23)
Plan
(0)
hisWorld
(0)
hiStory
(0)
hiStudy
(0)
hiSnap
(0)
홈
태그
미디어로그
위치로그
방명록
Windows Live Messenger
winapi
Join C
대학생 공모전
The Turing test page
훈스닷넷
C/C++ Reference
WIKI
/
/
블로그 내 검색
연습문제 23-1
연습문제 23-1
2008.02.18
연습문제 23-1
URUZ-7
2008. 2. 18. 19:56
2008. 2. 18. 19:56
#include
struct simple { int data1; int data2; }; void show(struct simple ts, struct simple ts2); void swap(struct simple* ps, struct simple* ps2); int main() { struct simple s1={1,2}; struct simple s2={3,4}; show(s1,s2); swap(&s1,&s2); //call by reference s1과 s2주소값을 인자로 swap함수 호출 show(s1,s2); return 0; } void show(struct simple ts, struct simple ts2) { printf("s1 data1:%d, data2:%d\n",ts.data1, ts.data2); printf("s2 data1:%d, data2:%d\n",ts2.data1, ts2.data2); } void swap(struct simple* ps, struct simple* ps2) { struct simple temp; //임시 저장할 simple구조체 변수 temp를 만들어 ps를 담고 //ps에 ps2를 담고 //ps2에 temp를 담는다. temp=*ps; *ps=*ps2; *ps2=temp; }
공유하기
게시글 관리
구독하기
Hisworld.tistory.com
PREV
이전
1
NEXT
다음
+ Recent posts
Powered by
Tistory
, Designed by
wallel
Rss Feed
and
Twitter
,
Facebook
,
Youtube
,
Google+
티스토리툴바