🔥Limited Offer: Get 50% OFFon AI & Full Stack Courses🔥
Back to C++ Notes
Topic #37

C-Style Strings


C-Style Strings

C-style strings are created with the char type instead of string.

The name comes from the C language, which, unlike many other programming languages, does not have a string type for easily creating string variables. Instead, you must use the char type and create an array of characters to make a "string" in C.

As C++ was developed as an extension of C, it continued to support this way of creating strings in C++:

Example

string greeting1 = "Hello";  // Regular String
char greeting2[] =
"Hello";  // C-Style String (an array of characters)

Note: It is more convenient to work with the standard string type, rather than C-style strings. However, one reason some users continue to use C-style strings is that they have access to functions from the C standard library.

A list of all C-style string functions, can be found in our CString Functions Reference.

Want to go beyond the notes?

Join CodingNow 2.0's C++ course — live mentorship, real projects, and 100% placement support.

Enroll Now — Free Demo Available

C-Style Strings – FAQs

Quick answers about learning C-Style Strings in C++.

This free note from CodingNow 2.0 explains C-Style Strings in C++ — concept, syntax and worked code examples you can copy, run and revise before interviews.
Yes. Every C++ topic on CodingNow 2.0, including C-Style Strings, is 100% free with no signup required.
With focused practice, most students grasp C-Style Strings in 1–3 days from these notes; pairing it with CodingNow 2.0's mentor-led course takes you to job-ready depth faster.
Use the code examples in this note, then ask doubts for free on the CodingNow 2.0 Community (/community) — expert instructors answer within 24 hours.
WhatsApp
Call NowEnroll Now