C/C++
wenzishou
这个作者很懒,什么都没留下…
展开
-
C/C++ assert使用
首先,assert是一个宏,而不是函数,看一个VS中中的定义#include #undef assert#ifdef NDEBUG#define assert(_Expression) ((void)0)#else#ifdef __cplusplusextern "C" {#endif_CRTIMP void __cdecl _wassert(_I原创 2015-02-10 16:35:05 · 2132 阅读 · 0 评论 -
C/C++如何得到int型最大值
在C/C++中,如何得到int型能表示的最大值,最小值?第一种方法:在limits.h/climits中,定义了INT_MAX,INT_MIN,可以直接使用第二种方法:如果要通过程序得到,比较简单的一种方法是靠操作内存中的二进制位了,具体需要了解数值在内存中的表示,牵涉到数据的原码、反码、补码。可以 #define MAX_INT ((unsigned int)-1)>>原创 2015-03-23 14:06:46 · 20105 阅读 · 2 评论 -
c++中的左移、右移运算
C++中的左移右移一直没有弄懂,看到 http://blog.csdn.net/hengshan/article/details/6440549写的很清晰简洁,就收下了,希望更多的人能够看到移位运算包含“逻辑移位”(logical shift)和“算术移位”(arithmetic shift)。逻辑移位:移出去的位丢弃,空缺位(vacant bit)用 0 填充。算术移位:转载 2015-04-09 23:56:40 · 3241 阅读 · 0 评论 -
KMP算法
字符串匹配算法,已通过测试 ,原理可以在网上查,按照算法导论里面内容实现。原创 2015-08-23 19:05:57 · 365 阅读 · 0 评论 -
[leetcode] Regular Expression Matching
原题如下: '.' Matches any single character.'*' Matches zero or more of the preceding element.The matching should cover the entire input string (not partial).The function prototype原创 2015-08-20 15:14:13 · 529 阅读 · 0 评论