Mercurial > hg > Members > taiki > cbc_test
changeset 0:e16c397c8845
add memo and change hello.cbc file.
author | Taiki TAIRA <e095767@ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 26 Apr 2012 16:45:40 +0900 |
parents | |
children | e8992ca15539 |
files | CbCmemo.txt hello.cbc |
diffstat | 2 files changed, 39 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/CbCmemo.txt Thu Apr 26 16:45:40 2012 +0900 @@ -0,0 +1,8 @@ + +関数に戻り値はなし。 +__code で関数は始まる。プロトタイプ宣言も。 +goto で関数呼び出し。 +loop 系の文は使わない。 + while for etc... + +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hello.cbc Thu Apr 26 16:45:40 2012 +0900 @@ -0,0 +1,31 @@ +#include <stdio.h> +#include <stdlib.h> + +__code loop_end(void) +{ + exit(0); +} + +__code loop_print(int count) +{ + printf("helloWorld\n"); + goto loop0(count); +} + +__code loop0(int count) +{ + if (count <= 10) { + printf("count :%d\n", count); + goto loop_print(count+1); + } else { + goto loop_end(); + } +} + +int main (void) +{ + int count = 0; + goto loop0(count); + return 0; +} +