码迷,mamicode.com
首页 >  
搜索关键字:ptr    ( 2121个结果
【C++】String类及其优化版的实现
#include using namespace std; class String { public: String() { _ptr = new char[1]; _ptr[0] = 0; } String(const char* str) { _ptr = new char[strlen(str)+1]; strcpy(_ptr,str);...
分类:编程语言   时间:2015-08-25 21:36:10    阅读次数:143
C/c++笔试经典程序(一)
1.输出结果比较1)输出结果:212)输出结果:12。虽然循环只进行了一次,但是对!X++来说,X还是进行了自加运算。2.指针运算输出结果8,8.程序运行时,printf语句是从右往左进行读取,此时ptr指向8.因为*和++的优先级相同,结合顺序是从右到左,所以*ptr++等价于*(ptr++)。3...
分类:编程语言   时间:2015-08-25 21:16:06    阅读次数:219
5.4 类型转换
VS2010上运行得到的结果注意:(int)a和(int&)a的操作不同,其汇编代码如下所示:int a1 = (int)a;011E1873 fld dword ptr [a] 011E1876 call @ILT+285(__ftol2_sse) (11E11...
分类:其他好文   时间:2015-08-25 13:40:08    阅读次数:154
C语言 malloc、calloc、realloc的区别
三个函数的申明分别是: void* malloc(unsigned size); void* realloc(void* ptr, unsigned newsize); void* calloc(size_t numElements, size_t sizeOfElement); 都在stdlib....
分类:编程语言   时间:2015-08-21 10:52:51    阅读次数:160
using gdb to debug c program
#include static void display(int i, int *ptr); int main(void) { int x = 5; int *xptr = &x; printf("In main():\n"); printf(" x is %d and is stored at %p.\n", x, &x); printf(" xptr ...
分类:数据库   时间:2015-08-20 20:58:40    阅读次数:194
C#模拟PrtScn实现截屏预备知识--keybd_event使用方法
Windows提供了一个模拟键盘API函数Keybd_event(),使用该函数可以相应的屏蔽键盘的动作。Keybd_event()函数能触发一个按键事件,也就是说会产生一个WM_KEYDOWN或WM_KEYUP消息。但是已经被SendInput取代。 语法: VOID keybd_event(BYTE bVk,BYTE bScan,DWORD dwFlags,Ptr dwExtralnfo);...
分类:Windows程序   时间:2015-08-20 10:32:14    阅读次数:228
linux简单内核链表排序
#include #include #define container_of(ptr, type, mem)(type *)((unsigned long)ptr -(unsigned long)&((type *)NULL)->mem) struct person { struct pers...
分类:编程语言   时间:2015-08-19 19:57:57    阅读次数:156
关于指针的加减操作
原题:main() { int a[5]={1,2,3,4,5}; int *ptr=(int *)(&a+1); printf("%d,%d",*(a+1),*(ptr-1)); }程序输出是什么。 解答: 程序输出: 2,5 分析: 这里主要是考查关于指针加减操作的理解。 对指针进行加1操作,得到的是下一个元素的地址,而不是原有地址值直接加1...
分类:其他好文   时间:2015-08-19 16:43:57    阅读次数:123
Boost::bind使用详解
1.Boost::bind 在STL中,我们经常需要使用bind1st,bind2st函数绑定器和fun_ptr,mem_fun等函数适配器,这些函数绑定器和函数适配器使用起来比较麻烦,需要根据是全局函数还是类的成员函数,是一个参数还是多个参数等做出不同的选择,而且有些情况使用STL提供的不能满足....
分类:其他好文   时间:2015-08-18 19:11:56    阅读次数:206
如何将Eclipse中的开源项目使用到Android Studio中
近几日,笔者用到了一些开源项目,比如著名的PTR项目。但是在使用的过程中,遇到了一些问题。这个开源库是在Eclipse上面写的,我们现在开发用的是Android stuido。两种软件的项目结构是不同的,那么怎么把PTR用到我们的项目中呢?通过查找网络资料等,终于摸索出了一套解决这些问题的方法,下面...
分类:移动开发   时间:2015-08-18 18:28:48    阅读次数:170
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!