清楚地了解const修饰的范围很有必要,如下是声明形式与相应含义: char*const cpl="I love you!“; //const修饰’*’,cp1是一个指向字符的指针常量 const char*cp2="I hate you!“; //const修饰’char' cp2是一个指向字符常量的指针 const char*const cp3="Get the hell out of here!“; // const分别修饰’char’和’*’,cp3是一个指向字符常量的指针常量
//test10.cpp
#include <graphics.h>
#include <iostream.h>
void Pixel(int x int y int color)
{
putpixel(x y color);
}
int Pixel(int x int y)
{
return getpixel(x y);
}
void main()
{
int Driver=VGA Mode=VGAHI;
initgraph(&Driver &Mode "");
Pixel(100 100 4);
int Color = Pixel(100 100);
closegraph();
cout << "Color of point(100 100):" << Color;
}