initial import
[staff/goc4/2018bti7061.git] / c-4-pointers / examples / c-pointers / pointers4.c
1 #include <stdio.h>
2
3 void funct1(int u, int v);
4 void funct2(int *pu, int *pv);
5
6 main(){
7 int u = 1;
8 int v = 3;
9 puts("before calling functions");
10 printf("u = %d; v = %d \n",u,v);
11 funct1(u,v);
12 puts("After funct1(u,v);");
13 printf("u = %d; v = %d \n",u,v);
14 funct2(&u,&v);
15 puts("After funct2(&u,&v);");
16 printf("u = %d; v = %d \n",u,v);
17 }
18
19 void funct1(int u, int v){
20 u = 0;
21 v = 0;
22 return;
23 }
24 void funct2(int *pu, int *pv){
25
26 *pu = 0;
27 *pv = 0;
28 return;
29 }
30 /* Output:
31 before calling functions
32 u = 1; v = 3
33 After funct1(u,v);
34 u = 1; v = 3
35 After funct2(&u,&v);
36 u = 0; v = 0
37 */