aboutsummaryrefslogtreecommitdiff
path: root/doc/user/src/prgm4.skb
blob: 734de540786a34748ae28e3880e453345bc0a223 (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
28
(use-modules (skribilo source c))
	     
(p [Here's how:])
   
 (linebreak)
 (prog
   (source :language c
[#include <stdlib.h>

static int foo = 10;
static float bar;

/* This is the function responsible
   for integer chbouibification.  */
float
chbouibify (int x)
{
  bar = foo + (float) x / random ();
  foo = (float) x * random ();

  if (x > 2)
    /* Great!  */
    printf ("hello world!\n");
  else
    printf ("lower than two\n");

  return ((float) foo * bar);
}]))