码迷,mamicode.com
首页 >  
搜索关键字:sizeof    ( 5917个结果
POJ 2506 Tiling(高精度+递推)
高精度模版(bin神的) /* * 高精度,支持乘法和加法 */ struct BigInt { const static int mod = 10000; const static int DLEN = 4; int a[600],len; BigInt() { memset(a,0,sizeof(a)); len =...
分类:其他好文   时间:2015-03-08 14:21:55    阅读次数:174
memcpy code
memcpy#include "string.h"/* * sizeof(word) MUST BE A POWER OF TWO * SO THAT wmask BELOW IS ALL ONES */typedef int word; /* "word" used for o...
分类:其他好文   时间:2015-03-06 16:57:14    阅读次数:146
sizeof() 之 数组
在平时的编程中,我们会经常用到数组,并且需要知道数组的长度,有时我们可以明确的知道数组的长度,但有时并不,这时,可以借用sizeof(),来获得数组的长度,如下:arrayLength = sizeof(array) / sizeof(array[0]);在使用sizeof() 获得数组长度时,.....
分类:编程语言   时间:2015-03-06 00:54:38    阅读次数:169
Sizeof与Strlen的区别与联系
一、sizeof sizeof(...)是运算符,在头文件中typedef为unsigned int,其值在编译时即计算好了,参数可以是数组、指针、类型、对象、函数等。它的功能是:获得保证能容纳实现所建立的最大对象的字节大小。由于在编译时计算,因此sizeof不能用来返回动态分配的内存空间的大小。实...
分类:其他好文   时间:2015-03-05 22:20:39    阅读次数:166
C++字符串使用sizeof时注意
char tmp1[20] = {"hello,你好"}; char tmp2[] = {"hello,你好"}; char *tmp3 = new char[20]; sprintf(tmp3,"%s","hello,你好"); string tmp4 = "hell...
分类:编程语言   时间:2015-03-05 00:00:54    阅读次数:354
HDU 1247 速算24点_BFS
1 #include 2 #include 3 #include 4 #define CL(x, y) memset(x, y, sizeof(x)) 5 using namespace std; 6 const int INF = 1 >ch) 18 { 19 ...
分类:其他好文   时间:2015-03-04 20:59:32    阅读次数:236
PAT:1048. Find Coins (25)(哈希表法) AC
#include#includeint HARSH[1066];int main(){ memset(HARSH,0,sizeof(HARSH)); int n,m; scanf("%d%d",&n,&m); for(int i=0 ; i0) { if(i==m-i && ...
分类:其他好文   时间:2015-03-04 00:58:14    阅读次数:147
SPOJ Problem 24:Small factorials
求阶乘,注意数据范围,要用高精。#include#includeint a[300];int n,x,y,l,i,j;int main(){ for (scanf("%d",&n);n--;){ scanf("%d",&x); memset(a,0,sizeof(a...
分类:其他好文   时间:2015-03-03 20:26:59    阅读次数:127
【C语言学习】union关键字
union关键字与struct关键字的用法很相似,先看例子: #include int main(void) { /*struct结构体*/ struct { int i; char a[4]; }s; /*union结构体*/ union { int i; char a[4]; }u; printf("sizeof(int)=%d\n",siz...
分类:编程语言   时间:2015-03-03 16:45:42    阅读次数:159
C Language Study - 内存分配的一个奇异之处
在复制字符串的时候,出现如下难以理解之处: 测试程序的目的是定义一个指针指向字符串常量,并且将这个字符串常量复制到另一个经过内存分配的字符串指针。 正常理解范围(1): #include #include #include int main(void) { char* p1 = "abcdefg"; char* p2 = (char*)malloc(sizeof(p1...
分类:其他好文   时间:2015-03-03 16:41:36    阅读次数:125
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!