C Primer 复习题

2.4

#include<stdio.h>
int main(void)
{
    int s;
    s = 52;
    printf("There are %d weeks in a year.",s);
    return 0;
}

2.5

a.Baa Baa Blacke Sheep.Have you any wool?

b.Begone!nO creature of lard!

c.What?

No/nfish?

d.2+2=4

2.6 都是

2.7

int n,m;

n=3020;

m=250;

printf("There were %d words and %d 350 lines",n,m);

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

3.1

a.int

b.float

c.char

d.short

3.2.超出int的表示范围时

在该系统中long可以容纳比int更大的数;另一个原因是如果确实需要处理更大的值,那么使用一种在所有系统上都保证至少是32位的类型会使程序的可移植性更好。

3.3

要获得正好是32位的数,可以使用int32_t 要获得可存储至少32位的最小类型,可以使用int_least32_t 。如果要在32位的类型中获得提供最快计算速度的类型,可以选择int_fast32_t。

3.4

a. char类型 char 常量

b. int类型 int 常量

c. float类型 double 常量

d. 八进制数 unsigned int 常量,十六进制格式

e. 科学计数法数 double 常量

3.5

原文地址:https://www.cnblogs.com/Khime/p/11622566.html