《C程序设计语言》读书笔记20091106
书中有几个问题有点模糊。记录一下。
Answer to Exercise 1-7
Write a program to print the value of EOF .
#include <stdio.h>
int main(void)
{
printf("The value of EOF is %d\n\n", EOF);
return 0;
}
EOF在stdio.h中的定义为#define EOF (-1)
其中()被忽略,只使用-1。
相关文档:
源码:
# include <stdio.h>
int main()
{
/* 定义一个整数类型的变量,用来存放后面算式的值 */
int logic;
int a = 1;
int b = 2;
int c = 3;
&n ......
源码:
# include <math.h>
# include <stdio.h> /* 数学函数库 */
int main()
{
/* 用s表示多项式的值,用t表示每一项的值 */
double s, t, x; // 此处用双精度声明变量
int n;
printf ......
源码:
# include <stdio.h>
/* 宏定义 */
# define MAX 100
# define LEN 80
/* 一个非常简单的文本编辑器 */
int main()
{
char text[MAX][LEN]; // 定义字符型数组
register int t, i, j; /* 定义三个寄存器变量 */
  ......
源码:
# include <stdio.h>
int main()
{
/* 有尺寸 */
/* 一维整形数组初始化 */
int array1[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
/* 一维字符型数组初始化,最后一个元素自动添加为‘/0 ......
源码:
/* 学生成绩查询系统 */
# include <stdio.h>
# include <stdlib.h>
int main( )
{
int select;
int i, j;
int score[5][7];
int average = 0;
int sum = 0;
&n ......