• R/O
  • SSH
  • HTTPS

descartes: Commit


Commit MetaInfo

Revision1648 (tree)
Time2012-12-15 13:23:15
Authorhniwa

Log Message

update of example

Change Summary

Incremental Difference

--- trunk/descartes/example/translator/pl0.7/f.c (nonexistent)
+++ trunk/descartes/example/translator/pl0.7/f.c (revision 1648)
@@ -0,0 +1,29 @@
1+#include <stdio.h>
2+#include <stdlib.h>
3+typedef int (*func) ();
4+
5+int main()
6+{
7+ int inc(const int n) {
8+ {
9+ return n + 1;
10+ }
11+ }
12+ int dec(const int n) {
13+ {
14+ return n - 1;
15+ }
16+ }
17+ int calc(const func f, const int n) {
18+ {
19+ return (*f) (n);
20+ }
21+ }
22+ {
23+ const int a = calc(inc, 1);
24+ const int b = calc(dec, 1);
25+ printf("%d ", a);
26+ printf("%d ", b);
27+ printf("\n");
28+ }
29+}
Show on old repository browser