未分类题

若已包括头文件<string.h>且已有定义char s1[18],s2={'ABCDE'}和int i,现要将字符串 'ABCDE'赋给s1,下列语句错误的是( )
A.strcpy(s1,s2)
B.strcpy(s1,'ABCDE');
C.s1='ABCDE';
D.for(i=0;i<6;i++) s1[i]=s2[i];

A.h>且已有定义char
B.strcpy(s1,s2)
B.strcpy(s1,'ABCDE');
C.s1='ABCDE';
D.for(i=0;i<6;i++)

【参考答案】

C
解析:数组名s1是代表s1数组首地址的地址常量,而不是变量,因为“=”左边不能出现常量, 因此 sl='AB......

(↓↓↓ 点击下方‘点击查看答案’看完整答案 ↓↓↓)
热门 试题

未分类题
Questions 16-22?Read the minutes of the meeting below.?Are the sentences 16-22 'Right' or 'Wrong'? If there is not enough information to answer 'Right' or 'Wrong', choose 'Doesn't say' .?For each sentence (16-22), mark one letter (A, B or C).MINUTES OF THE MEETING HELD INCONFERENCE ROOM NO. 8ON MONDAY 19TH MAY 2008Present: Mr Wang Kai, General Manager, in the chairMr Li Fei, Production ManagerMr Huang Shu, Purchase ManagerMs Oheng Li, Sales ManagerMiss Song Yu, Secretary (Minutes Keeper)The meeting was opened at 8.30 A.m. by Mr Wang Kai.Apologies for absenceMr Hu Su, Personnel ManagerMiss Lu Ping, Sales AssistantⅠ.Minutes of the last meeting.The minutes of the last meeting were read, confirmed and signeD.Ⅱ.Changing of promotion materialsMs Chena Li suggested changing the company's promotion materials as many new products have been launched since 2005. It was agreed that Ms Cheng would update the promotion materials and that she would submit the drafts at the next meeting on 18th JunE.Ⅲ.The company's holidaysMr Wang announced the dates of the company's holidays= 5th to 16th July, inclusive:24th December to 5th January, inclusivE.Ⅳ.SecurityMr Wang raised the problem of office security, who suggested that all important papers should be kept in the safE.It was agreed that only those present at the meeting would have the key to the safE.Ⅴ.There being no further business, Mr Wang closed the meeting at 9:30am.The promotion literature shoul.d be upgraded because many new products have come out.A.RightB.WrongC.Doesn't say
A.30
B.m.
C.Minutes
D.Changing
E.The
F.Security
G.There
H.
The
I.d
J.
A.Right
B.Wrong
C.Doesn't