Computer Engineering
[C++] const 상수로 정의하면
Jack2
2011. 11. 8. 10:41
#include <iostream>
using namespace std;
int main()
{
const unsigned short studentPerClass = 30;
// studentPerClass = 50; //변경이 불가능함.
=> 위의 주석을 제거해서 컴파일을 시도하면
error: assignment of read-only variable 이라는 에러가 발생한다.
=> 위의 주석을 제거해서 컴파일을 시도하면
error: assignment of read-only variable 이라는 에러가 발생한다.
cout<< studentPerClass << endl;
return 0;
}