C专家编程精编之一
C专家编程 精编之一 第一章~第三章
C的复杂之处 在于它的指针 ,但是比其指针更为复杂的是它的声明 !!!
你能看懂它们的意思 吗?
apple=sizeof(int)*p ; apple=sizeof * p;
j= (char (*)[20])malloc(20);
int const * grape; 与 int * const grape; 的区别
typedef void (*ptr_to_func)(int);
void (*signal(int sig,void (*func)(int )))(int );
几个样例:
一:char *a; const char *b; a=b;//出现警告. why?
二: const int two =2;
switch(i)
{
case 1:printf("case 1 ! \n");
case two :printf("case 2\n");
}
编译出错,说明了.....?
三:switch(){..}中把 default改成 defau1t (无心之过,或其它标签如defavlt,dafault..)都编译通过 . why?
四: apple=sizeof(int)*p ; apple=sizeof * p; //是什么意思? 另外, y=sizeof x; 能编译通过吗?
五: j= (char (*)[20])malloc(20); //怎么样?
六: result=*x/*y ; //出错?why ?
z=y+++x; 即为: z=y++ +x; 但z=y+ + +x; &n
相关文档:
jjhou.csdn.net里面有
--------------------------------------------------------------------------------
在 console mode 中使用 C/C++ 编译器
侯捷 1999.04.08
......
1、编写一个布尔函数int is_leap_year(int year),判断参数year是不是闰年。如果某年份能被4整除,但不能被100整除,那么这一年就是闰年,此外,能被400整除的年份也是闰年。
#include <stdio.h>
int is_leap_year(int);
int main(){
int i,j;
printf("please input a number:");
scanf("%d",& ......
2010-04-09
第十五章 输入/输出函数
1、错误报告
perror函数 void perror( char const *message);
2、终止执行
void exit( int status ); 原型定义于stdlib.h
其中status参数返回给操作系统,用于提示程序是否正常完成,这个值和main函数返回的整型状态 ......
. 编译单元(模块):
在IDE开发工具大行其道的今天,对于编译的一些概念很多人已经不再清楚了,很多程序员最怕的就是处理连接错误(LINK ERROR), 因为它不像编译错误那样可以给出你程序错误的具体位置,你常常对这种错误感到懊恼,但是如果你经常使用gcc,makefile等工具在linux或者嵌入式下做开发工作的 ......
vs2008里面定义全局变量:
extern bool *g_previewStatusArray = new bool[EQUIPMENT_AMOUNT](); //被默认初始化为false
但是如果不加上后面的括号,则默认初始化为true。 ......