博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
微软暑期实习笔试题
阅读量:4154 次
发布时间:2019-05-25

本文共 743 字,大约阅读时间需要 2 分钟。

A. const char *pContent; //pContent 是指针,指向的是const char

B. char * const pContent;//pContet 首先是一个const 的变量,然后是一个指针,也就是说是一个const 的指针,指向char

C. char const *pContent;//和A一样,因为const 可以放在类型前,也可以放在类型后

D. const char* const pContent;

5. What is the output of the follow code?void main(int argc, char* argv[]) {	int i = 11;	int const *p = &i;	p++;	cout<<*p<

一定要仔细!!

Which of the following C++ code is correct: 
  
(A)  
  
int f() 

     int *a = new int ( 3 ); 
     return *a; 

有内存泄露问题
(B) 
  
int* f() 

     int a[ 3 ] = { 1, 2, 3 }; 
     return a; 

//局部变量  
(C) 
  
vector<int> f() 

     vector<int> v( 3 ); 
     return v; 

  
(D) 
  
void f( int* ret ) 

     int a[ 3 ] = { 1, 2, 3 }; 
     ret = a; 
     return; 

//ret 是指针,形参对于指针而言,是值传递。对于f(a),a的值不发生任何变化

//另外要注意,int a[3] = new int [3]是错误的,一定要用指针

(E) 
  
none of above 

转载地址:http://jdeti.baihongyu.com/

你可能感兴趣的文章
素数对--腾讯2017校招编程
查看>>
JAVA集合--ArrayList实现原理
查看>>
synchronized与Lock
查看>>
数据库索引
查看>>
实现包含min,max,push,pop函数的栈
查看>>
实验2-6 字符型数据的输入输出
查看>>
实验3-5 编程初步
查看>>
实验4-1 逻辑量的编码和关系操作符
查看>>
实验5-2 for循环结构
查看>>
实验5-3 break语句和continue语句
查看>>
实验5-4 循环的嵌套
查看>>
实验5-5 循环的合并
查看>>
实验5-6 do-while循环结构
查看>>
实验5-7 程序调试入门
查看>>
实验5-8 综合练习
查看>>
第2章实验补充C语言中如何计算补码
查看>>
深入入门正则表达式(java) - 命名捕获
查看>>
使用bash解析xml
查看>>
android系统提供的常用命令行工具
查看>>
【Python基础1】变量和字符串定义
查看>>