Which can replace lines 5 and 6 in the following function ? 1 /* copy string2 to string1 */ 2 void strcopy(char string1[], char string2[]) 3 { 4 int i = 0; 5 while (string1[i] = string2[i]) 6 i++; 7 }[/i][/i]
A: while (*string1 = *string2) ;
B: while (*string1 = string2) ;
C: while (*string1++ = *string2++) ;
D: while (*++string1 = *++string2) ;
A: while (*string1 = *string2) ;
B: while (*string1 = string2) ;
C: while (*string1++ = *string2++) ;
D: while (*++string1 = *++string2) ;
举一反三
- 下列语句正确的是( ) A: char string[]; string="china"; B: char string1[],string2[]; string2={"china"}; strcpy(string1,string2); C: char string1[5],string2[]={"china"}; string1=string2; D: char string[]="china";
- Complete the following function: /* copy string2 to string1 */ void strcopy(char string1[], char string2[]) { int i = 0; while (string2[i] != '\0') { string1[i] = string2[i]; i++; } ____<br/>}[/i][/i][/i] A: return; B: string1[i - 1] = '\0'; C: string1[i] = '\0'; D: string1[i + 1] = '\0';
- 下列【1】【2】【3】【4】注释标注的哪行代码有错误?import java.util.*;public class E {public static void main(String args[]) {Map<;String,String>; map = new HashMap<;String,String>;(); //【1】Set<;Integer>; treeSet = new TreeSet<;Integer>;();//【2】Map<;String,String>; treeMap= new TreeMap<;String,String>;(); //【3】List<;char>; list = new LinkedList<;char>;(); //【4】 A: 【1】 B: 【2】 C: 【3】 D: 【4】
- 下述()语句能够正确地生成5个空字符串。 A: String a[]=new String[5];for(int i=0;i<;5;a[i++]=“”); B: String a[5]; C: String [5] a; D: String [] a=new String[5];for (int i=0;i<;5;a[i++]=null);
- 下面哪个语句能够正确地生成5个空字符串?( ) A: String a[]=new String[5]; for(int i=0;i<;5;a[i++]=""); B: String a[5]; C: String []a=new String[5]; for( int i=0;i<;5;a[i++]=null); D: String[5]a;