码迷,mamicode.com
首页 >  
搜索关键字:const 底层const 顶层const    ( 26295个结果
c++ string assign =
C++ string类的成员函数,用于拷贝、赋值操作,它们允许我们顺次地把一个string 对象的部分内容拷贝到另一个string 对象上。string &operator=(const string &s);把字符串s赋给当前字符串string &assign(const char *s);用c类...
分类:编程语言   时间:2014-07-09 23:22:50    阅读次数:287
学习C/C++之回调函数
1、函数指针在学习回调函数之前,连了解下函数指针。(1)概念指针是一个变量,用于表示内存的地址。在程序运行中,任何东西都要加载到内存,这就决定了任何东西都可以用指针指向。函数是放在内存的代码区,它同样有地址,同样可以用指针来指向。(2)例子//定义一个函数void invoke(const char...
分类:编程语言   时间:2014-07-09 22:35:53    阅读次数:309
C++ 中 const 使用
如果你一看见C++中const就脱口而出:“常量!”那只能说明你对c++不甚了解。或者说你太2了.const得一些使用方法与场景如下:1:const修饰普通变量,全局变量,静态变量1 const int iTmp = 1;2 int const iTmpEx = 2;变量保持其原有属性,只是多了一个...
分类:编程语言   时间:2014-07-09 22:22:08    阅读次数:241
c++ string c_str() 和data()区别
看下面的英文解释:const char* c_str ( ) const;Get C string equivalentGenerates a null-terminated sequence of characters (c-string) with the same content as the...
分类:编程语言   时间:2014-07-09 20:40:50    阅读次数:345
第一个c++程序
#include using namespace std;int main(int argc, const char * argv[]){//cin接收键盘输入 int age; double height; char name[10];// cout 在控制台输出一些信息// 相当于c语...
分类:编程语言   时间:2014-07-09 00:37:35    阅读次数:270
《OOC》笔记(1)——C语言const、static和extern的用法
当const修饰一个普通变量时,则这个普通变量不应被修改。当const修饰一个指针变量时,这个指针指向的内容不应被修改,也不应让其它指针指向这个内容。extern用于声明全局变量的方法:首先在头文件x.h里用extern修饰该变量的声明部分,然后在源文件x.c中定义该变量。
分类:编程语言   时间:2014-07-08 23:37:07    阅读次数:339
sort函数用法
头文件: #include using namespace std; 1.默认的sort函数是按升序排序。  sort(a,a+n);                //两个参数分别为待排序数组的首地址和尾地址 2.可以自己写一个cmp函数,按特定意图进行排序。 例如 : 1).对数组a降序排序 int cmp( const int &a, const int &b ){...
分类:其他好文   时间:2014-07-08 20:11:02    阅读次数:172
const 与 指针
#include using namespace std; int main() { // 第一种,使指针不能修改对象的值,注:此时指针可以指向另外的对象 int i = 10; int j = 100; const int *pi = &i; // 限定指针无法修改对象的值 //*pi = 1000; // error! pi = &j; cout<<*pi<<e...
分类:其他好文   时间:2014-07-08 15:45:26    阅读次数:180
ZOJ Monthly, October 2010 ABEFI
ZOJ 3406 Another Very Easy Task #include #include const int N = 100005; char s[N]; int main() { bool f = 0; int size = 0; char ch; while(scanf("%c", &ch)!=EOF) { if( !(ch >= 'a' && c...
分类:其他好文   时间:2014-07-08 13:52:14    阅读次数:265
Understanding Safari Reader
Interesting enough to find out the Reader function in Safari is actually Javascript and there are many interesting stuff from the 2000 line code: * 5 main parts in the file: * 1. define const * 2...
分类:其他好文   时间:2014-07-08 13:11:46    阅读次数:469
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!