Skip to content

Instantly share code, notes, and snippets.

@taroyabuki
Last active December 19, 2015 05:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save taroyabuki/5908014 to your computer and use it in GitHub Desktop.
Save taroyabuki/5908014 to your computer and use it in GitHub Desktop.
Literate Programming
@ hello, world! と出力するC言語のプログラムは以下のとおり。
@c
@<Header files to include@>@/
@<The main program@>
@ 標準入出力のためのライブラリを利用するようにコンパイラに指示する。
@<Header files to include@>=
#include <stdio.h>
@ main関数を、引数の無い関数として定義する。関数内の文は、波括弧の間に記述する。
@<The main program@>=
main()
{
@<Print out characters@>;
}
@ printfという名前を使って関数を呼び出す。この関数は、引数として与えられた文字列を表示する。文字列(リテラル)は2重引用符で囲う。
@<Print out characters@>=
printf("hello, world\n");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment