プログラミング: February 2008 Archives

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

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

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

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

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

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

About this Archive

This page is a archive of entries in the プログラミング category from February 2008.

プログラミング: August 2008 is the next archive.

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