String Data Structure

  • Last Updated : 26 Sep, 2023

DSA for Beginners
Learn more about String in DSA Self Paced Course
Practice Problems on String

What is String?


Strings are defined as an array of characters. The difference between a character array and a string is the string is terminated with a special character ‘\0’.

String Data Structure


Below are some examples of strings:

“geeks”, “for”, “geeks”, “GeeksforGeeks”, “Geeks for Geeks”, “123Geeks”, “@123 Geeks”

How String is represented in Memory?


In C, a string can be referred to either using a character pointer or as a character array. When strings are declared as character arrays, they are stored like other types of arrays in C. For example, if str[] is an auto variable then the string is stored in the stack segment, if it’s a global or static variable then stored in the data segment, etc.

What is String & How String is represented in Memory

What is String & How String is represented in Memory


Topics:

Introduction:

String in different language:

Basic Operations of String:

Binary String:

Substring & Subsequence:

Palindrome:

Pattern Searching:

Standard problems on String:

Quick Links:

Recomended:

If you like GeeksforGeeks and would like to contribute, you can also write an article and mail your article to review-team@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.