《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()
{
/* 定义一个整形指针p */
int *p;
int begin, end;
begin = 10;
/* 给指针p赋初值 */
p = &begin;
& ......
源码:
# include <stdio.h>
int main()
{
int num;
/* 下面定义的各变量,分别代表个位,十位,百位,千位,万位,十万位以及位数 */
int indiv, ten, hundred, thousand;
int ten_thousand, hundred_thous ......
源码:
# include <stdio.h>
int main( )
{
int radius;
double area;
for(radius = 1; radius <= 10 ; radius++)
{
area = 3.1416 * radius * radius;
......
源码:
# include <stdio.h>
/* 子函数声明 */
int square(int x); // 实现求平方值的子函数
int cube(int y); // 实现求立方值的子函数
int main()
{
int m = 12;
int n = 4;
printf("%d %d\n", sq ......
源码:
# 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 ......