|||
#include <iostream>
using namespace std;
const int MAX=4;
int main()
{
const char *names[MAX]={
"zara ali",
"Hina Ali",
"Nuha Ali",
"Sara Ali",
};
for (int i=0;i<MAX;i++)
{
cout<<"value of names["<<i<<"]=";
cout<<*names[i]<<endl;
}
cin.get();
return 0;
}
输出结果:
value of names[0]=z
value of names[1]=H
value of names[2]=N
value of names[3]=S
#include <iostream>
using namespace std;
const int MAX=4;
int main()
{
const char *names[MAX]={
"zara ali",
"Hina Ali",
"Nuha Ali",
"Sara Ali",
};
for (int i=0;i<MAX;i++)
{
cout<<"value of names["<<i<<"]=";
cout<<names[i]<<endl;
}
cin.get();
return 0;
}
输出结果:
value of names[0]=zara ali
value of names[1]=Hina Ali
value of names[2]=Nuha Ali
value of names[3]=Sara Ali
Archiver|手机版|科学网 ( 京ICP备07017567号-12 )
GMT+8, 2024-11-23 11:19
Powered by ScienceNet.cn
Copyright © 2007- 中国科学报社