码迷,mamicode.com
首页 >  
搜索关键字:sizeof    ( 5917个结果
Delphi中String和PChar指向的内存中的字符串的互相转换
直接给一个源码的例子,自己去看procedure TForm1.Button1Click(Sender: TObject);var S_Str: String; P_Str: PChar;begin GetMem(P_Str; Sizeof(Char)*20); S_Str:...
分类:Windows程序   时间:2015-04-18 19:01:48    阅读次数:130
qsort函数应用大全
七种qsort排序方法    一、对int类型数组排序  int num[100];  Sample:  int cmp ( const void *a , const void *b )  {  return *(int *)a - *(int *)b;  }  qsort(num,100,sizeof(num[0]),cmp);  二、对char...
分类:其他好文   时间:2015-04-18 14:36:09    阅读次数:108
hdu 4248 A Famous Stone Collector
首先发现一个很头痛的问题,下面是2个求排列组合的代码1 memset(C,0,sizeof(C));2 for(int i=0;i 2 #include 3 #include 4 #define MOD 1000000007 5 using namespace std; 6 typedef...
分类:其他好文   时间:2015-04-18 12:58:22    阅读次数:130
struct与union
1. union的长度union{ int k; int p[4]; double q;}data;sizeof(data)=20; //结构体中最大的数据长度2.struct的长度struct{ int k; double q;}data;sizeof(data)=16; //结...
分类:其他好文   时间:2015-04-18 11:15:27    阅读次数:114
C++获取系统时间
#include "iostream" #include "windows.h" #include "string" using namespace std; int main(){ SYSTEMTIME ct; GetLocalTime(&ct);;//如果用GetSystemTime(&ct),则获取的是格林尼治时间 int year = ct.wYear; int month...
分类:编程语言   时间:2015-04-17 18:20:57    阅读次数:142
C++面试中关于sizeof问题总结
原文:http://blog.sina.com.cn/s/blog_7c983ca60100yfdv.html#SinaEditor_Temp_FontName(1)sizeof是操作符,不是函数。MSDN:The sizeof keyword gives the amount of storage...
分类:编程语言   时间:2015-04-17 17:21:17    阅读次数:194
C语言中内存对齐方式
内存对齐,因为它是对C/C++程序员透明的,在很多C,C++课本中也没有讲清楚,所以今天写了这篇博客,讲述为什么需要内存对齐,内存对齐怎么计算·····...
分类:编程语言   时间:2015-04-17 11:42:10    阅读次数:134
数组名与数组首地址
int _tmain(int argc, _TCHAR* argv[]) { char i[10] = { 0 }; printf("%d %d\n",i,sizeof(i)); printf("%d %d\n",&i,sizeof(&i)); printf("%d %d",&i[0],sizeof...
分类:编程语言   时间:2015-04-17 10:57:30    阅读次数:202
卡片游戏
#include "stdafx.h"#include #include const int MAXN = 50;int queue[MAXN];int main(){ int n,front,rear; scanf_s("%d",&n,sizeof(n)); for(int i ...
分类:其他好文   时间:2015-04-17 09:36:04    阅读次数:115
计算C++类所占用的字节(即sizeof)
在类中,如果什么都没有,则类占用1个字节,一旦类中有其他的占用空间成员,则这1个字节就不在计算之内,如一个类只有一个int则占用4字节而不是5字节。如果只有成员函数,则还是只占用1个字节,因为类函数不占用空间。虚函数因为存在一个虚函数表,需要4个字节,数据成员对象如果为指针则为4字节,注意有字节对齐...
分类:编程语言   时间:2015-04-16 23:39:23    阅读次数:285
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!