Loose-Info.com
Last Update 2012/07/05
TOP - C言語 - 宣言 - const

constを付けて宣言をすると、その値が変更できないことを示します。
基本的に初期値を指定する必要があります。

const   型名    名前1  =  値1 ;

型名 :
変数の型
名前1 :
変数の名前
値1 :
変数の初期値

(例)
#include <stdio.h> int main () { const int n = 5; printf("n = %d (変更不能)\n", n); return 0; }

実行結果
n = 5 (変更不能)