질문2 가 아직 답이 안되있어요ㅠ.ㅠ
읽어주세요.....ㅠ.ㅠ
질문 3은
#include <stdio.h>
void swap (int*pa, int*pb, int*pc)
{
int temp;
temp=*pa;
*pa=*pc;
*pc=*pb;
*pb=temp;
}
int main(void)
{
int a=10, b=20, c=30;
printf("스왑하기전: %d %d %d\n", a,b,c);
swap(&a,&b,&c);
printf("스왑한후: %d %d %d\n", a,b,c);
return 0;
}
이것은 되는데
temp를 포인터로 바꾸면 어떻게되는지 궁금해서
int *temp;
*temp=*pa;
*pa=*pc;
*pc=*pb;
*pb=*temp;
이렇게 했더니
temp가 initialize가 안됬다네요....
함수안에서는 포인터를 못만드나요??
(int* a,int* b,int* c)는 되는데
{
int *blah 는 안되나요??
} |