Back Button
Back to Chapter
C++ Introduction
No items found.
C++ Basics
No items found.
C++ Control Statements
No items found.
C++ Logical Operators
No items found.
C++ Procedural Programming
No items found.
C++ Structural Programming
No items found.
C++ Implementation of OOPS
No items found.
C++ Arrays and Vectors
No items found.
C++ Error Handling
No items found.
C++ File Handling
No items found.
Collapse_Icon
Table of Contents

A string is basically an array of characters. In C++ anything written within a double quotes is a string.

Consider the first hello world program

char greeting[13] = "hello world";
char greeting[] = "what";// YOU NEED NOT PLACE THE '\0' CHARACTER

"\0" is used automatically added at the end of a string.

#include using namespace std; int main () { char greeting[5] = "hello nice to meet you"; cout << "Question: "; cout << greeting << endl; return 0; }
Output: Question: hello nice to meet you