您的位置:首页 > 编程语言 > C语言/C++

重学C++ 指向常量数据的非常量指针

2013-04-20 21:48 162 查看
//源码来自《C》

#include<iostream>
using std::cout;
using std::endl;

void printCharacters(const char*);

int main()
{
	char phrase[]="characters and $32.98";

//	cout<<"The phrase before conversion is:"<<phrase<<endl;
	printCharacters(phrase);
//	cout<<"The phrase after conversion is:"<<phrase<<endl;
	return 0;
}

void printCharacters(const char* phrase)
{
	while(*phrase!='\0')
	{
		cout<<*phrase;
		phrase++;
	}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: