《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 a = 5;
char c = 'a'; // 'a'的ASC码的值为97
  ......
源码:
# include <stdlib.h>
# include <stdio.h>
int main()
{
int month;
int day;
printf("please input the month number: ");
scanf("%d", &mo ......
源码:
# 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 ......
源码:
# include <stdio.h>
void swap(int *x, int *y);
int main()
{
int i, j;
i = 12;
j = 36;
printf("i and j before swapping: %d %d\n", i, j);
&nbs ......