易截截图软件、单文件、免安装、纯绿色、仅160KB

c指针

c指针的运算有时候还是很迷惑人的。
例如:
struct student {
int num;
int score;
int length;
};
struct student *pt;
pt = (struct student *) malloc(sizeof(struct student));
pt->num = 1;
pt->score = 90;
pt->length = 3 * sizeof(int);
printf("pt length:%d\n", *pt);
pt = (int *)pt + 1;
printf("pt length:%d\n", *pt);
pt = (int *)pt + 1;之后pt的类型还是struct student,长度还是12。
强制转换类型运算符()的作用是:生成一个int *类型的pt,但是pt原来的类型还是没变,
换句话说就是,强制转换类型运算符只在运算时起作用,并不影响原来的值。


相关文档:

Optimizing Your C/C++ Applications


C/C++ optimizing compilers are great--but there *are* a few techniques for hand-tuning your code to run as efficiently as possible on the AMD Athlon64 and Opteron processors, especially when developing DLLs, device drivers, or other performance-bound pieces of code.
Alan Zeichick  
Share | ......

C/S模式与B/S模式的比较分析

一、C/S模式与B/S模式的比较分析
  C/S模式主要由客户应用程序(Client)、服务器管理程序(Server)和中间件(middleware)三个部件组成。客户应用程序是系统中用户与数据进行交互的部件。服务器程序负责有效地管理系统资源,如管理一个信息数据库,其主要工作是当多个客户并发地请求服务器上的相同资源时,对这些资源进行最 ......

C/C++ 与运算和或运算转换大小写

// & 与,将指定位置设置为0     | 或,将指定位置设置为1
//注: 只针对纯字母的情况
#include <stdio.h>
#include <string>
int main()
{
char str[6] = "xxing";
std::string str1 = "INGXX";
for(int i = 0; i < 5; i++)
{
str[i] &= 0xdf; ......

memcachde 与 c/c++ 应用

修改makefile,在LIBS里面加上-lmemcached,比如原来 gcc test.c,现在 gcc test.c -lmemcached。这个库就是libmemcached提供的。
然后添加#include<libmemcached/memcached.h>,这个文件也是libmemcached提供的。
主函数里面需要添加:
    memcached_st *memc;
    uint32_t&nbs ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号