当我使用char或char*时,visual studio 2012(11)只会播放最后一个字符,例如:
#include <iostream>
#include <string>
int main(){
using namespace std;
char chName = 'Alex';
cout<<chName;
}
Run Code Online (Sandbox Code Playgroud)
它只显示"x".它是正确的是我使用
string strName = "Alex"
但在那些有参数作为char的函数中,字符串不能作为参数传递.在这种情况下,VS编译器说字符串不能转换为int.还告诉我char和char*之间有什么区别.我是一名PHP开发人员,C++非常混乱.请帮我.