blob: 912a66ddcb51570ddcc5da68fc6da8c61dd6d428 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
#include <u.h>
#include <libc.h>
/*
* this program proofs that effectively, pointer arguments are passed by
* value and its modification doesn't extend beyond the scope of the
* currently running procedure.
*/
void
incptr(char *p)
{
p += 3;
print("%s\n", p);
}
void
main()
{
char *s;
s = "hi there!";
print("%s\n", s);
incptr(s);
print("%s\n", s);
exits(0);
}
|