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
相关文档:
C 调用 Fortran
c2ffn.f
SUBROUTINE NAMEAGE(NAME, NLEN, AGE, TEMP)
CHARACTER*(*) NAME
INTEGER NLEN,AGE
REAL TEMP
C
WRITE(6,1000) NAME(1:NLEN),AGE,TEMP ......
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",& ......
#include <unistd.h>
#include <fcntl.h>
#include
<sys/types.h>
#include <sys/ioctl.h>
#include
<stdlib.h>
#include <stdio.h>
#include
<linux/soundcard.h>
/* 下面的三个参数是跟具体文件相关的,文件什么样,就要设置成什么样 */
#define RATE 11025&nbs ......
[C/C++ Digestion] – Rule of Three,
复制控制
作者:
Jason Lee @
http://blog.csdn.net/jasonblog
日期:
2010-04-13
[1]
复制构造函数
copy constructor
Rule of Three
是指类如果需要析构函数,则通常也需要复制构造函数和赋值操作符。而其实习惯地显示编写这三者本就是一个良好的习惯。因 ......
C字符串处理函数的实现(Linux)
#include <stddef.h>
char * ___strtok = NULL;
char * strcpy(char * dest,const char *src)
{
char *tmp = dest;
while ((*dest++ = *src++) != '\0')
/* nothing */;
return tmp;
}
char * strncpy(char * dest,const char *src,size_t count)
{
char *tmp = d ......