C++的"abc"类型是什么?
What is the type of "abc" in C++?
C++中"abc"的类型是什么?候选人可以是const char*
或char*
。
还有什么可以想到的吗?
在教程点上,我尝试过:
#include <iostream>
#include <typeinfo>
using namespace std;
int main()
{
cout << typeid("abc").name() << endl;
cout << typeid ( const char * ).name() << endl;
cout << typeid( char * ).name() << endl;
cout << typeid( char[4]).name() << endl;
cout << typeid( const char[4]).name() << endl;
return 0;
}
输出为:
A4_cPKc
个人电脑
A4_cA4_c
[4],但肯定不是字符*或常量字符*
相关文章:
- 静态自动 constexpr t = { "red" , "black" , "green" } 是什么类型;派生到?
- 这是什么类型的C++语法,我应该采取什么步骤来理解这一点
- 这在C++是什么类型的错误?
- int(int)& 或 int(int) const &是什么类型?
- 我如何找出3D容器的元素是什么类型
- 在 c 和 c++ 中,二维数组的元素是什么类型?
- 这个 lambda 的参数是什么类型?
- 转换逻辑目标是什么类型
- 如果我创建一个修改值的迭代器,静态成员"reference"应该是什么类型?
- 这是什么类型的行为
- 给定以下内容,"function"是什么类型?
- C++:文本文件中的数据是什么类型的
- C++11 中的"auto var = {condition} ? 1 : 1.0"是什么类型?是双精度还是整数?
- C++中的 decltype(this) 是什么类型
- 如何知道模板<类型名称类型>是什么类型?
- 内置数组的大小是什么类型?
- c++ 11中的std::chrono::high_resolution_clock::now()是什么类型?
- 在Microsoft Visual C++中,光线跟踪器应该是什么类型的项目
- 如何为delete编写一个C包装器,既快速又释放给定的任何类型,而不告诉它是什么类型
- 如何编写一个函数,无论数组是什么类型都输出它