answersLogoWhite

0


Best Answer

We use a pointer to reference a string because a string is an array of characters where every element is a char (or a wchar_t if using UNICODE strings). Passing arrays by value would require the entire array to be copied, but passing a pointer variable to an array only copies the pointer, which is effectively the same as passing the array by reference.

#include <iostream>

int main()

{

char * psz = "hello"; // pointer to a null-terminated string.

std::cout << psz; // pass the pointer (by value) to the insertion operator.

return( 0 );

}

User Avatar

Wiki User

11y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Why pointer is used to reference a string of characters write C plus plus statements that display the text hello using pointer to a string notation?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How do you display nonprinting characters?

You simply have to type to an editor like the notepad to display the non-printing characters.


characters that display somewhat thicker and darker?

Can you please provide more context for characters who display somewhat thicker and darker characteristics?


Characters that display somewhat thicker?

Bold


How do you display Chinese characters in Windows?

To display Chinese characters, the Chinese Language Support is needed. Please check the step-by-step guide below.


In word characters that display somewhat thicker?

Bold


How many characters colors can Excel display?

8


Can Excel display characters in many colors?

Like all modern applications Excel has the capability to show things in various colours, so it can display characters in many colours.


What allows the user to utilize simple statements to specify the data to display print or store?

query


How many words can you put in a cell box?

It depends on the length of each word. The number of words does not matter; the limit is the number of total characters, including spaces. The maximum length of cell contents (text) is 32,767 characters. Only 1,024 display can display in a cell, but all 32,767 characters display in the formula bar.


How do you display 4.26 million in numerals only?

It is: 4,260,000 and expressed in scientific notation it is 4.26*106


What is the characters display somewhat thicker and darker than normal?

bold


How many words can you fit in one Microsoft Excel cell?

It depends on the length of each word. The number of words does not matter; the limit is the number of total characters, including spaces. The maximum length of cell contents (text) is 32,767 characters. Only 1,024 display can display in a cell, but all 32,767 characters display in the formula bar.