C with classes
This commit is contained in:
19
C/BasicSyntax/Pointer/pointer_test1.cpp
Normal file
19
C/BasicSyntax/Pointer/pointer_test1.cpp
Normal file
@@ -0,0 +1,19 @@
|
||||
#include <stdio.h>
|
||||
void swap(int * a, int * b){
|
||||
int temp;
|
||||
temp = * a;
|
||||
* a = * b;
|
||||
* b = temp;
|
||||
}
|
||||
int main()
|
||||
{
|
||||
int a,b;
|
||||
scanf("%d%d",&a,&b);
|
||||
int *t1,*t2;
|
||||
t1=&a;
|
||||
t2=&b;
|
||||
swap(t1,t2);
|
||||
printf("%d %d\n",t1,t2);
|
||||
printf("%d %d\n",*t1,*t2);
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user