• R/O
  • SSH
  • HTTPS

descartes: コミット


コミットメタ情報

リビジョン1648 (tree)
日時2012-12-15 13:23:15
作者hniwa

ログメッセージ

update of example

変更サマリ

差分

--- 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+}
旧リポジトリブラウザで表示