随笔分类 -  C/C++面试题

摘要:#include #include #include void f_sum(double* ,double*,double*); void i_sum(int *,int *,int *); void c_sum(char*,char*,char*); int main(int argc,char **argv) { int a=10; int b=5; double c=2.3; ... 阅读全文
posted @ 2016-07-17 16:09 道心不可练 阅读(234) 评论(0) 推荐(0)
摘要:1 #include 2 #include 3 char * fun1(char * p) 4 { 5 printf("%s\n",p); 6 return p; 7 } 8 char * fun2(char * p) 9 {10 printf("%s\n",p);11 return p;12... 阅读全文
posted @ 2015-06-22 22:02 道心不可练 阅读(170) 评论(0) 推荐(0)
摘要:c部分:::::::::::::::::::::::::::::::::::27、 关键字volatile有什么含意? 并给出三个不同的例子。【参考答案】一个定义为volatile的变量是说这变量可能会被意想不到地改变,这样,编译器就不会去假设这个变量的值了。精确地说就是,优化器在用到这个变量时必须... 阅读全文
posted @ 2015-06-14 11:53 道心不可练 阅读(1863) 评论(0) 推荐(0)
摘要:#includevoid quick_sort(int a[],int left,int right){ int l = left; int r = right; int n = a[left]; if(left >= right) return; whi... 阅读全文
posted @ 2015-06-12 14:52 道心不可练 阅读(226) 评论(0) 推荐(0)
摘要:#include #include int main(){ int count = 1; char str[1024]; int i=0; int j =0; char ch='0'; while(ch != '\n') //输入一串英文 { ... 阅读全文
posted @ 2015-06-06 16:42 道心不可练 阅读(561) 评论(0) 推荐(0)
摘要:如程序:#include #include using namespace std;int main(){ int a[]={15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0}; int i,j; int len = sizeof(a)/sizeof(in... 阅读全文
posted @ 2015-06-06 14:38 道心不可练 阅读(223) 评论(0) 推荐(0)
摘要:#include #include using namespace std;int main(){ char str[1024]; cin>>str; int i = 0; while(str[i]!='\0') { ... 阅读全文
posted @ 2015-06-06 11:55 道心不可练 阅读(163) 评论(0) 推荐(0)
摘要:#include #include using namespace std;int mystrcmp(const char * str1,const char * str2){ int i=0; while(1) { if(str1[i]=='\0' &&str2[i]!='\0') ... 阅读全文
posted @ 2015-06-06 11:31 道心不可练 阅读(272) 评论(0) 推荐(0)
摘要:#include #include #include #include #include using namespace std;int main(){ char p[1024]; cin>>p; int len = strlen(p); int i,j; unsig... 阅读全文
posted @ 2015-06-05 21:48 道心不可练 阅读(1330) 评论(0) 推荐(0)
摘要:1 #include 2 #include 3 #include 4 void getmemory(char *p) 5 { 6 p=(char *) malloc(100); 7 strcpy(p,"hello world"); 8 } 9 10 11 in... 阅读全文
posted @ 2015-06-04 16:33 道心不可练 阅读(261) 评论(7) 推荐(0)
摘要:#include #include using namespace std;void get_size(char str[100]){ cout<<"size in get_size "<<sizeof(str)<<endl; }int main(){ cha... 阅读全文
posted @ 2015-06-04 15:57 道心不可练 阅读(788) 评论(0) 推荐(0)