C++ Programming

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?

345

Top Answer
User Avatar
Wiki User
Answered
2012-06-07 07:52:31
2012-06-07 07:52:31

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 );

}

001
๐Ÿ˜‚
0
๐ŸŽƒ
0
๐Ÿคจ
0
๐Ÿ˜ฎ
0
User Avatar

Related Questions


Yes, yes some the characters do indeed display that trait.


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


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


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.


You can have 32,767 characters. Only 1,024 characters will display in a cell, but the others are there and all will be displayed on the Formula bar.


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


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.


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.


That depends on the calculator model. Typically, a calculator would switch to scientific notation when the number is less than 0.001, or greater than can be shown on screen in normal notation.



is this in reference to 1080p? that means that the display is 1920 x 1080. or 1,920 pixels wide by 1,080 pixels high. They measure displays by number of pixels, pixel density, and contrast (how dark are the blacks).


That would depend on the size of the LCD, and the fontsize you were using.


When the flag is not on display, only those present in uniform should face toward the music and act in the same manner they would if the flag were on display


Assuming the questioner is asking where the 10 Statements are located in a synagogue, the answer is that if a synagogue has the 10 Statements on display, they are usually located on or above the ark containing the Torahs at the front of the prayer sanctuary.


It depends on your calculator. You may find that you need to go to set up and then display mode.


No, the remote does not have a display. The CD changer main unit has a display of only 13 alphanumeric characters for a CD description.


Digital clocks display a numeric representation of time. Two numeric display formats are commonly used on digital clocks:the 24-hour notation with hours ranging 00-23;the 12-hour notation with AM/PM indicator, with hours indicated as 12AM, followed by 1AM-11AM, followed by 12PM, followed by 1PM-11PM (a notation mostly used in the United States and Canada).


Most calculators don't have enough digits to display this, so they show the result in scientific notation.


If there is an invalid cell reference you will see #REF! in the cell. If you refer to a defined range name that does not exist or a function name that does not exist you will see the #NAME! error.


It is an output devices that is used to monitor the displays of the alphanumeric characters and the graphical images.



YouTube, DeviantArt, and other places where you can display images and/or videos.


It will display either the current cell or a name of a named range if that range is selected. If the range selected is not named, then the name box show the cell reference of the active cell.


It will fill the cell with the # sign or change the number to scientific notation.


They display the characters in the book...and very loosely depict what will happen in them.



Copyright ยฉ 2020 Multiply Media, LLC. All Rights Reserved. The material on this site can not be reproduced, distributed, transmitted, cached or otherwise used, except with prior written permission of Multiply.