What is a String in C? – The Complete Guide for 2025

What is String in C?

String is a collection of characters. It is a one dimensional array of characters.
There are two ways to declare string in c language.

1. By char array

2. By string literal

Declaring string by char array

char c[11]={'i', 'n', 't', 'e', 'l', 'l', 'i', 'p', 'a', 'a', 't' ,’'};

Declaring string by string literal

char c[]="intellipaat";

Example 

#include <stdio.h>
#include <conio.h>
void main ()
{
char c1[11]={'i', 'n', 't', 'e', 'l', 'l', 'i', 'p', 'a', 'a', 't' ,’'};
char c2[]="intellipaat";
printf("Char Array Value : %sn", c1);
printf("String Literal Value : %sn", c2);
getch();
}

Output
Char Array Value: intellipaatString Literal Value is: intellipaat

No. Function Description
1) strlen(string_name) Returns the length of string name.
2) strcpy(destination, source) Copies the contents of source string to destination string.
3) strcat(first_string, second_string) Concats or joins first string with second string. The result of the string is stored in first string.
4) strcmp(first_string, second_string) Compares the first string with second string. If both strings are same, it returns 0.

Check out other Programming Tutorials


PyCharm Introduction

Data Warehouse Architecture

Structures and Union

Storage Classes in C

About the Author

Software Developer | Technical Research Analyst Lead | Full Stack & Cloud Systems

Ayaan Alam is a skilled Software Developer and Technical Research Analyst Lead with 2 years of professional experience in Java, Python, and C++. With expertise in full-stack development, system design, and cloud computing, he consistently delivers high-quality, scalable solutions. Known for producing accurate and insightful technical content, Ayaan contributes valuable knowledge to the developer community.