2013年11月1日金曜日

開発環境

C実践プログラミング 第3版 (Steve Oualline (著)、 望月 康司 (監訳) (翻訳)、谷口 功 (翻訳)、オライリー・ジャパン)のⅡ部(単純なプログラミング)の10章(Cプリプロセッサ)、10.1(#define文)、設問 10-2を解いてみる。

その他参考書籍

設問 10-2.

コード

sample.c

#include <stdio.h>

#define MAX 10

int main()
{
    int counter;
    
    for (counter = MAX; counter > 0; --counter){
        printf("Hi there\n");
    }
    return (0);
}

makefile

CC=cc
CFLAGS=-g

sample: sample.c
 $(CC) $(CFLAGS) -o sample sample.c

clean:
 rm -f sample

入出力結果(Terminal)

$ make
cc -g -o sample sample.c
$ ./sample
Hi there
Hi there
Hi there
Hi there
Hi there
Hi there
Hi there
Hi there
Hi there
Hi there
$

0 コメント:

コメントを投稿