易截截图软件、单文件、免安装、纯绿色、仅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原来的类型还是没变,
换句话说就是,强制转换类型运算符只在运算时起作用,并不影响原来的值。


相关文档:

理解c中的序列点

理解c中的序列点
 
 
http://blog.chinaunix.net/u1/42826/showart_364176.html
让我们来看看下面的代码:
int i=7;
printf(”%d\n”, i++ * i++);
你认为会返回什么?56?no。正确答案是返回 49?很多人会问为什么?难道不该打印出56吗?在ccfaq中有非常详尽的解释,根本原因在于c中的序列 ......

C/C++单元测试理论精要(六)

2.1 可测性问题详解(2)
   
    接下来我们讨论重点问题:覆盖输入。一个函数,输入会有哪些呢?输入包括两方面:外部输入,内部输入。外部输入容易理解,就是函数外部可以设定的输入,包括参数,全局变量,成员变量。
    
   
  &nb ......

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 | ......

[VC]函数调用约定解析(C/C++)

C/C++函数调用约定和函数名称修饰规则探讨
作者:星轨(oRbIt)
 
使用C/C++语言开发软件的程序员经常碰到这样的问题:有时候是程序编译没有问题,但是链接的时候总是报告函数不存在(经典的LNK
2001错误),有时候是程序编译和链接都没有错误,但是只要调用库中的函数就会出现堆栈异常。这些现象通常是出现在C和C ......

C。。。。越来越和谐了啊。。= =

输入一个英文语句(不记标点符号,单词之间只有一个空格),再逆向输出
例如:I am game boy
         boy game am I
#include<stdio.h>
#include<string.h>
int f(char,char,int,int);
int main()
{
char a[80]={0},b[80]={0},c[80]={0};
int i,n,m=0;
......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号