File: test61.ci

package info (click to toggle)
clif 0.90.2-3
  • links: PTS
  • area: main
  • in suites: slink
  • size: 4,336 kB
  • ctags: 2,815
  • sloc: ansic: 29,914; yacc: 4,338; lex: 644; makefile: 373; sh: 48
file content (64 lines) | stat: -rw-r--r-- 708 bytes parent folder | download | duplicates (7)
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
int 
fakt (int n)
{
  if (n == 1)
    return 1;
  else
    return (fakt (n-1) * n);
}

struct a
{
  int a;
  double b;
};

struct a a;

struct a
foo (struct a a)
{
  struct a b;
  b.a = 1;
  b.b = 3.14;
  a.a += b.a;
  a.b += b.b;
  return a;
}

struct a *ptr;

double
bar (struct a *a, struct a b[])
{
  b[1].a += 1;
  b[1].b += 6.28;
  return a->b;
}

struct a ar[3];

int
main ()
{
  struct a b;
  int i;
  
  printf ("n! = %d\n", fakt (10));

  a.a = 1;
  a.b = 3.14;

  i = scanf ("%d %lf", &b.a, &b.b);
  printf ("%d %g %d\n", b.a, b.b, i);
  
  b = foo (a);

  printf ("2=%d 6.28=%g", b.a, b.b);
  
  ptr = &a;
  printf (" %g\n", bar (ptr, ar));
  printf ("%d %g\n", ar[1].a, ar[1].b);

  return 0;
}