码迷,mamicode.com
首页 >  
搜索关键字:unsigned    ( 4409个结果)
基于引用计数的智能指针
编程语言中实现自动垃圾回收机制方式有好几种,常见的有标记清除,引用计数,分代回收等。 C++需要手动管理垃圾,可以自己实现一个智能指针。最简单的是引用计数的思路 template class SmartPointer { T* obj; unsigned int* count; SmartPointer(T* ptr) { obj = ptr; ...
分类:其他好文   时间:2015-07-30 23:31:19    阅读次数:194
atoi代码实现
atoi函数atoi函数是实现数字字符串转整型数,实现代码的时候,要特别注意以下几点: 前面有空格,调过 要注意符号,即是正还是负数 非法输入 处理溢出 代码实现int my_atoi(const char *str) { const char *s; char c; unsigned int cutoff; int acc; int neg, any, cu...
分类:其他好文   时间:2015-07-30 21:25:55    阅读次数:139
C++类成员函数的传参问题
最近代码中经常会出现,成员函数传参经常会发生值传不进去的情况,也是比较低级的错误,这里整理一下供大家参考一下。 (1)成员变量名与形参名相同World::World(unsigned maxContacts, unsigned iterators) { resolver = ite...
分类:编程语言   时间:2015-07-30 00:33:47    阅读次数:127
Number of 1 Bits
题目:Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as theHamming weight).For example, the 32-bit...
分类:其他好文   时间:2015-07-30 00:28:50    阅读次数:137
*Reverse Bits
题目:Reverse bits of a given 32 bits unsigned integer.For example, given input 43261596 (represented in binary as00000010100101000001111010011100), retu...
分类:其他好文   时间:2015-07-30 00:18:26    阅读次数:203
u32、u16、u8 数据类型
#define U32 unsigned int #define U16 unsigned short #define S32 int #define S16 short int #define U8 unsigned char #define S8 charunsigned char = u8 unsigned short int = u16 unsigned long int...
分类:其他好文   时间:2015-07-29 21:29:25    阅读次数:213
C中signed与unsigned
1 unsigned int i=3;2 cout 2 #include 3 int main(void) 4 { 5 char a[1000]; 6 int k = 0; 7 for (; k 2 3 int main(void) 4 { 5 unsigned a = 10; 6...
分类:其他好文   时间:2015-07-29 19:00:46    阅读次数:132
IOS switch-case知多少
1. switch参数类型switch参数类型要求是integer type,准确来讲,是可以转换成integer的类型, 这包括所有的C基本数据类型((signed/unsigned)char, (short/long signed/unsigned)int, float, double, lon...
分类:移动开发   时间:2015-07-28 22:40:40    阅读次数:6295
哈弗曼编码
#include #include #include #define MY_STRMAX 100 #define infinity 1000000 typedef struct { unsigned int weight; //深度 char ch; //结点数值 unsi...
分类:其他好文   时间:2015-07-28 21:06:14    阅读次数:104
由一个成员函数来启动一个线程
/*shows how to start a thread based on a  class memeber function using a static member function.*/ #define WIN32_LEAN_AND_MEAN #include #include #include #include typedef unsigned(WINAPI *P...
分类:编程语言   时间:2015-07-28 14:34:14    阅读次数:161
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!