请教C++高手解惑!!!char *pChar = (char*)pszSrc;中(char*)是什么意思?去掉括号为什么有错??
//StringCopy.cpp:Definestheentrypointfortheconsoleapplication.//#include"stdafx.h"#in...
// StringCopy.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "iostream.h"
void CopyString(const char* pszSrc, char* pszDes)
{
char *pChar = (char*)pszSrc;
char *pDes = pszDes;
while(*pChar != ' ')
{
*pDes = *pChar;
pDes ++;
pChar++;
}
}
int main(int argc, char* argv[])
{
char szDes[128] = {0};
CopyString("VC编程词典!", szDes);
cout << szDes << endl;
return 0;
} 展开
//
#include "stdafx.h"
#include "iostream.h"
void CopyString(const char* pszSrc, char* pszDes)
{
char *pChar = (char*)pszSrc;
char *pDes = pszDes;
while(*pChar != ' ')
{
*pDes = *pChar;
pDes ++;
pChar++;
}
}
int main(int argc, char* argv[])
{
char szDes[128] = {0};
CopyString("VC编程词典!", szDes);
cout << szDes << endl;
return 0;
} 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询