constval.cpp

来自「ThinkingC++中文版」· C++ 代码 · 共 25 行

CPP
25
字号
//: C08:Constval.cpp
// From Thinking in C++, 2nd Edition
// Available at http://www.BruceEckel.com
// (c) Bruce Eckel 2000
// Copyright notice in Copyright.txt
// Returning consts by value
// has no meaning for built-in types

int f3() 
{ 
	return 1; 
}
const int f4() 
{ 
	int a=0;
	return a; 
}

void main() {
  const int j = f3(); // Works fine
//    const int j = f4();
  int k = f4(); // But this works fine too!
  k = f3();
} ///:~

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?