generated at
C


2次元配列の動的確保の例
for文と malloc を使う
行によって異なる列数の配列を作成できる
c
int i, row = 3, col = 4; int **a = (int**)malloc(sizeof(int*) * row); for (i=0; i<row; i++){ a[i] = (int*)malloc(sizeof(int) * col); }
解放は以下のようにする
c
for(i=0; i<row; i++){ free(a[i]); } free(a);

コンパイル
$ gcc -o hello hello.c
実行
$ ./hello

formatter
install
$ brew tap tcr/tcr
$ brew install clang-format

外部ライブラリのincludeの仕方がわからん
GMPを使いたいのだが、どこかでdownloadなどをしないといけないのか?
とりあえずこれ見た


パッケージマネージャ
一応あるらしいがメジャーではないらしい