问题 单项选择题

有以下程序: main() { char a,b,c,*d; a='\';b='\xbc'; c='\0xab';d="\017"; printf("%c%c%c\n",a,b,c,*d); } 编译时出现错误,以下叙述中正确的是( )。

A.程序中只有“a='\';”语句不正确

B.“b='\xbc';”语句不正确

C.“d="\0127";”语句不正确

D.“a='\';”和“c='\0xab';”语句都不正确

答案

参考答案:D

解析: 语句a='\'是错误的,因为\是转义字符,应该用\\来表示,语句“B='\xbc';”是正确的,它是将一个用十六进制表示的转义字符赋给一个字符型变量;语句“c=\0xab;”是错误的,反斜线后的十六进制只可由小写x开头,不能用0x。语句“d="\0127";”是正确的,可以给字符型指针变量赋一个字符串常量,其作用是让该指针变量指向该字符串常量。所以,D选项为所选。

名词解释
选择题
A businessman, with a large amount of money, was walking through a remote (偏远的) area. Upon    31   this, a thief followed him, planning to    32   his money at a certain time. The businessman noticed something was   33  , and he started to pay much more   34  to the thief.
The businessman soon asked the thief if he  35   help find some water nearby, and when the thief went to   36   the water, the businessman put all of his   37   into the thief’s bag. Then the thief returned and told the businessman    38   the water was.   39   the businessman left to get some water, the thief quickly    40   the businessman’s bag. Certainly, there was nothing that the thief    41  .
The thief was    42  , but he still did not give up hope. After some time, the businessman returned and they both    43   for a long time. Then the businessman got tired and    44   under a big tree. The thief again checked the businessman’s bag and still did not find any money. So the thief    45   that the businessman did not actually have any money with him.
Finally, they arrived at a city. When the thief went after a job and left his own bag behind, the businessman    46   in and took back all of his own money he had put there    47  . When the thief came back, he was surprised to see that the businessman was    48   some jewels with the money in his bag. The thief couldn’t    49   asking the question, “I didn’t know you had money on the    50  .” The businessman smiled to him, “Of course you didn’t, because it is not yours.”
小题1:
A.talkingB.learningC.thinkingD.speaking
小题2:
A.keepB.borrowC.stealD.put
小题3:
A.newB.commonC.strangeD.dangerous
小题4:
A.careB.mercyC.needD.attention
小题5:
A.wouldB.couldC.shouldD.must
小题6:
A.carry onB.look forC.watch overD.bring along
小题7:
A.goodsB.foodC.moneyD.clothes
小题8:
A.howB.whatC.thatD.where
小题9:
A.As soon asB.As far asC.As well asD.As long as
小题10:
A.hidB.searchedC.exploredD.changed
小题11:
A.savedB.plannedC.ownedD.wanted
小题12:
A.frightenedB.angryC.surprisedD.nervous
小题13:
A.drankB.walkedC.restedD.discussed
小题14:
A.satB.stoodC.sleptD.stopped
小题15:
A.agreedB.wishedC.doubtedD.believed
小题16:
A.putB.gotC.reachedD.broke
小题17:
A.rightlyB.luckilyC.reallyD.formerly
小题18:
A.buyingB.wearingC.havingD.showing
小题19:
A.keepB.helpC.enjoyD.avoid
小题20:
A.tripB.visitC.holidayD.business