140k views
0 votes
In memory, C++ automatically places a ________ at the end of string literals.

a. Semicolon
b. Quotation marks
c. Null terminator
d. Newline escape sequence
e. None of the above

User JChap
by
5.5k points

1 Answer

4 votes

Answer:

c.Null Terminator.

Step-by-step explanation:

in memory C++ automatically places the null terminator also called null pointer at the end of the string.For example:-

#include<iostream>

using namespace std;

int main()

{

char s[200];

s="every thing is great";

int i=0;

while(s[i]!='\0')

{

cout<<s[i];

i++;

}

return 0;

}

We have taken a string and stored "every thing is great" in it after the next position of the character t in the string there will be a null character.Which C++ automatically places at the end.That's why we are running a loop till the character in the string is not '\0' null character

User Mozhi
by
7.5k points