填空题
若有如下图所示5个连续的int类型的存储单元并赋值,a[0]的地址小于a[4]的地址。 p和s为int型的指针变量。请对以下问题填空。
①若p已指向存储单元a[1]。通过指针p给s赋值,使s指向最后一个存储单元a[4]的语句是
【7】
。
②若指针s指向存储单元a[2],p指向存储单元a[0],表达式s-p的值是
【8】
。
【参考答案】
[7]s=p+3;[8]2
点击查看答案&解析
<上一题
目录
下一题>
热门
试题
填空题
有以下程序: #include <iostream> using namespace std; class Sample private: int n; public: Sample(int i)n=i; void print() cout<< 1:n= <<n<< , ; void print() const cout<< 2:n= <<n<<end1; ; int main() Sample a(10); const Sample b(20); a.print(); b.print(); 上述程序运行后的输出结果是 【13】 。
点击查看答案&解析
填空题
有以下程序: #include <iostream> using namespace std; void t(int x,int y, int cp,int dp) cp=x*x+y+y; dp=x*x-y*y; int main() int a=4,b=3,c=5,d=6; t(a,b,c,D) ; cout<<c<< , <<d<<end1; return 0; 运行后的输出结果为 【9】 。
点击查看答案&解析
相关试题
在下面横线上填上适当的语句,完成程序。 ...
以下程序的执行结果是 【15】 。 #in...
在用class定义一个类时,数据成员和成员函...