COMPUTER SOFTWARE
PROGRAMMING LANGUAGES
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
We can iterate over string
|
True
|
|
False
|
|
Either A or B
|
|
None of the above
|
Explanation:
Detailed explanation-1: -One way to iterate over a string is to use for i in range(len(str)): . In this loop, the variable i receives the index so that each character can be accessed using str[i] .
Detailed explanation-2: -Use strlen() to get the length of the string. for(int i = 0; i < strlen(full name); i++) printf("%c", full name[i]); Since the string is terminated by ‘’, which is 0 in ASCII value, you can also use full name[i] !=
Detailed explanation-3: -Iterating In A String Array Iteration over a string array is done by using java for loop, or java for each loop. The code starts from index 0, and continues up to length – 1, which is the last element of the array.
There is 1 question to complete.