问题 单项选择题

有以下程序
void fun(char *c,int d)
*c=*c+1;d=d+1;
printf(“%c,%c”,*c,d);

main()
char a='A',b='a';
fun(&b,

A.;printf(“%c,%c\n”,a,

B.;

答案

参考答案:D

解析:用地址作为参数与值作为参数传递之间的不同。在C语言中,数据传递是单向传递的。“值传递”就是实参把对应的值传给相应的形参变量,然后形参和实参不再有任何联系,在被调用函数中,对形参的修改并不影响对应的实参。“地址传递”就是实参把相应的地址传给相应的形参变量,在被调用函数中对形参的修改将修改对应的实参地址对应的值。程序中定义了两个字符型变量'a'和'b',并分别赋初值为'A'和'a',然后调用函数fun(),将b的地址和:值作为实参。在函数fun()中第一个参数是传递地址,故在调用函数fun()中对参数做的修改(即将b值加1)将影响字符型变量的值(变为 b),函数fun()第二个参数是传值的,故在调用函数fun()对第二个参数做的修改不影响字符型变量a(即'a'的值仍为'A'),所以在fun()函数中输出的是d为b,B,接着在主函数中,输出a,b,然后退出fun()函数,接着执行后面的语句,输出A,b。所以最后输出为b, B,A,b。

阅读理解

On Nov.18th, 1908, three men went up in a balloon. They started early in London. The headman was Auguste Gaudron, and the other two men were Tannar and Maitland. They had a big balloon and they were ready for a long way.

Soon they heard the sea. They were carrying the usual rope, and it was hanging down from the basket of the balloon. At the end of the rope they had tied a metal box. This could hold water, or it could be empty. So they were able to use the box to change the weight of the balloon. The three people were also carrying some bags of sand.

After the sun rose, the balloon went higher. It went up to 3,000 metres, and the air was very cold. The water in the balloon became ice. Snow fell past the men’s basket, and they could see more snow on the ground. The men tried to throw out some more sand; but it was hard. They tried to break the icy sand with their knives, but it was not easy. The work was slow and they were still falling, so they had to drop some whole bags of sand. One of them fell on an icy lake and made a black hole in the ice.

  At last they pulled the box into the basket. It was still snowing; so they climbed to get away from the snow. They rose to 5,100 metres! Everything became icy. They were very cold and  they decided to land. They came down in Poland heavily but safely. They had travelled 1,797 kilometres from London!

小题1:Where did they start their travel on Nov.18th, 1908?

                                                                            

小题2:What was the metal box used for?

                                                                            

小题3: Why did they have to drop some whole bags of sand during the travel?

                                                                            

小题4: How long did they travel in the end?

                                                                            

小题5:

What do you think of the three people and their travel? (请自拟一句话作答)

                                                                            

名词解释