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
相关文档:
也是中软笔试的算法题,当时并不知道叫杨辉三角,唉。N年不用了,还得再拾起,为了那个梦。
#include <stdio.h>
void main()
{
int a[50][50];
int i,j,n;
printf("Please input Number:");
scanf("%d",&n);
  ......
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",& ......
第一篇:typedef struct与struct的区别
1. 基本解释
typedef为C语言的关键字,作用是为一种数据类型定义一个新名字。这里的数据类型包括内部数据类型(int,char等)和自定义的数据类型
(struct等)。
在编程中使用typedef目的一般有两个,一个是给变量一个易记且意义明确的新名字,另一个是简化一些比较复杂的类型声明 ......
2010-04-09
第十五章 输入/输出函数
1、错误报告
perror函数 void perror( char const *message);
2、终止执行
void exit( int status ); 原型定义于stdlib.h
其中status参数返回给操作系统,用于提示程序是否正常完成,这个值和main函数返回的整型状态 ......
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 ......