ちょっとしたプログラミングクイズ 第一弾

| | Comments (0) | TrackBacks (0)
C言語を知っている方は是非トライしてみてください。いい復習になると思います。

問題①If statementを使わずに絶対値を返す関数またはマクロを書け。

問題②swap() functionをTemporary Variableを使わずに書け。

まあ普通はこんな感じですよね。さあ、どうやってtempを使わずにスワップしますか?

void swap(int* i, int* j)
{
int temp = *i;
*i = *j;
*j = temp;
}

ちなみに僕的には問題①のほうが簡単だと思います。

0 TrackBacks

Listed below are links to blogs that reference this entry: ちょっとしたプログラミングクイズ 第一弾.

TrackBack URL for this entry: http://us.ms-square.com/cgi/mt/mt-tb.cgi/11

Leave a comment


画像の中に見える文字を入力してください。

About this Entry

This page contains a single entry by Manabu published on February 23, 2008 8:54 AM.

アクセスログ was the previous entry in this blog.

ジミー大西の英会話教室! is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.