微软暑期实习笔试题
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<<endl; } A. 11 B. 12 C. Garbage value D. Comipler error E. None of above Choose: C
一定要仔細!!
Which of the following C++ code is correct:?
??
(A)??
??
int f()?
{?
???? int *a = new int ( 3 );?
???? return *a;?
}?
有內(nèi)存泄露問題
(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的值不發(fā)生任何變化
//另外要注意,int a[3] = new int [3]是錯誤的,一定要用指針
(E)?
??
none of above?
總結(jié)
- 上一篇: svm的smo算法
- 下一篇: arrive get