Table of Contents
Back Button
Back to Chapter
C++ Setting Up
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.

C++ Strings

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
Ask queries
Contact Us on Whatsapp
Hi, How Can We Help You?