Given the following definition and initialization. Write a code fragment including a loop that will overwrite the string greeting, with ‘X’ in all character position, keeping the length the same.
What will be an ideal response?
The loop runs from 0 up to the position of the null character where the loop stops,
without overwriting the null terminator.
```
int index = 0;
while (greeting[index] != ‘\0’)
{
greeting[index] = ‘X’;
index++;
```
Computer Science & Information Technology
You might also like to view...
A primary key field is a field that uniquely identifies the record
Indicate whether the statement is true or false
Computer Science & Information Technology
A numbered list is used for items that can be listed in any order
Indicate whether the statement is true or false
Computer Science & Information Technology